My "topics" table contains 10 entires
*--------------*
topicid topic
------
*--------------*
01 Bye
02 Hi
03 Hello
.....
10 Morning
*--------------*
<?php //topics.php
require_once("includes/connection.php");
....
....
ttopics[]= //I have 10 strings here which have changed by now.
foreach ($ttopics as $ttkey)
{
//I am trying to update my "topics" table whenever these strings change, based on the topicid (primary key).
//Please correct my code.
$id = mysql_real_escape_string('topicid');
$topic = mysql_real_escape_string('topic');
$result = mysql_query("SELECT topicid, topic FROM table WHERE topicid='{$id}' and topic='{$topic}' ");
if($result)
{
$num = mysql_num_rows( $result );
if ($num == 0)
{
$querypost = mysql_query ("INSERT INTO trendingtopics (topic) VALUES ('$ttkey')");
}
}
I am getting an error. Lets say the position of Morning is first and Bye is last. It should update the database accordingly. If there is a new entry, say "phpfreaks" in first position. It should update according.
array_combine() trouble w/csv file
I have a problem with a piece of code I wrote to import some records from a csv file into mysql. I have a .csv file with about 300 records in it. The code worked perfect while testing on 3 or 4
Is STL important?
I'm just starting programming and I've made it until the Standart Template Library. But the chapter seems incredibly boring, daunting and complicated, it looks so awful that I haven't yet read it so I
Text Not Displaying Correctly With PHP:GD
I recently moved servers and since then I have noticed that one line of text is showing weirdly.I have attached an example image that was generated. In the word 'Managing' the letters M & N
textfield unchanged
hi,i want my form to know whether its textbox is unchange or not.if($textbox == 'unchanged'){ //do this}else{ //do this}ive been searching all day , but cant find the exact solutions...
ereg_replace issue
hi there peoplei have this code happening with regards to my wamp server. is this something that can be sorted out? would this happen on a normal remote server that has lamp on with the necessary
Using insert variable
need a way to inert variable data to mysql database $acc = "212121212";$nok = "Nokia1100";$db_link = mysql_connect("localhost","root",
Strange PHP/mySQL error ... am I just tired?
Code: <?## CONNECT TO DB FUNCTION!function ConnectTo($db2con){ $hostName = "localhost"; $dbName = "people_".$db2con; $userName = "people_main"; $password =
Sending UDP Raw socket
I truly need help on this. I am trying to write a test program that simulate a network environment that have 5 clients and 1 server. To do so, I need to be able to edit IP header to change it's
PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page will use code to pull information from a database and display it on the page in a formatted way.Code:
Grouping and sorting results
Please help with this query.I have 2 tables in a database, countires and cities. states looks like thiscountriesid -----------country1 ------------uk2 ------------us3 ------------japancitiesid