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.
Get ID from Database when Posting with a HTML Form
I have a form I am submitting to a MySql database. Each product has an ID # attached to it that auto_increment.I need to pull the auto incremented ID # for the entry I just posted onto the page so the
Is it possible to stop reservation creation in PM Order?
Hi All,
Internal Server Error issues
This has been bothering me for weeks and I've been trying to solve it without asking for help, but eventually I had to give up Basically, I have a website that is based around manipulating photos with
Will this protect from mysql injection?
I do not want anything like DROP TABLE to work or any type of coding.. Heres my code.. is it secure? if not, please help:Code:
DirectoryIterator and Hacked Website
Hi Everyone.My problem:Some one has been sneaking in to my website hidden Iframes. I've changed passwords & reset permissions to read, but then the permissions get changed to include write and
Create or replace package is ending ORA-21700
Database 9.2.0., patch 8 (9.2.0.8.0).
Form errors in an array
I'm processing a form and putting the errors in an array. empty($errors) doesn't seem to do the trick when trying to check to see if the array is empty. Is my understanding of empty()incorrect? Each
a dificult string search
Hi I don't know a way around this. I want the user to input a password, but to make it a bit complcated the password can be several words. "Today is Sunday"However I want to exclude certain
Secure FTP
Hi experts,
Help with captcha script needed
Hello, I am working on a script where reCAPTCHA or a similar form of CAPTCHA will be used, for the sake of this example I will talk about reCAPTCHA. I wanted to know how I could have the reCAPTCHA