Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 10-22-2004, 11:07 PM   #1 (permalink)
easilyi
Registered User
 
Join Date: Aug 2004
Location: USA - West Coast
Posts: 9
easilyi is on a distinguished road
Simple PHP MySQL code: confused.

HI,

I have been working on this site for a while and this page USED to work. Now all of a sudden it is acting up.

All I am trying to do is query a MySQL table and print the contents on a page.

Here is my only code dealing with the table:
PHP Code:
          <?php

          $db 
mysql_connect("localhost""username""password");
          
mysql_select_db("wordpress",$db);

          
$result mysql_query("SELECT user_name, user_prefix FROM wp_prefix ORDER BY user_name");

          while (
$row mysql_fetch_array($resultMYSQL_NUM))
          {
            
$name   $row[0];
              
$prefix $row[1];
            
$table  $prefix 'posts';

            
$result2 mysql_query("SELECT * FROM $table ORDER BY post_date desc");
            
$myrow   mysql_fetch_array($result2);
            
$id      $myrow["ID"];
            
$date    $myrow["post_date"];
            
$title   $myrow["post_title"];

            
printf("<li><ul>
            <a href=\"wordpress1/index.php\"><b>$name</b></a><br />
            <small><b>Last Post:</b><br />$date<br /><b>Title:</b><br />
            <a href=\"wordpress1/index.php?p=$id\">$title</a></small><br />
            </ul></li>"
);
          }

          
mysql_free_result($result);

          
?>
The problem is, every time I refresh this page, it inserts a record into my table. So weird. I even deleted the table completely, rebuilt the table, left it blank and ran this page and sure enough it added a case to the table.

Any ideas?
easilyi is offline   Reply With Quote
Old 10-22-2004, 11:20 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
i know it sounds funny, but are you sure you looking at the right page? in this code example it is completely impossible for this code to be inserting a row into your table.
__________________
Mike
sde is offline   Reply With Quote
Old 10-22-2004, 11:58 PM   #3 (permalink)
easilyi
Registered User
 
Join Date: Aug 2004
Location: USA - West Coast
Posts: 9
easilyi is on a distinguished road
yeah, that is what i thought, impossible!

that is why i am frustrated...

i will look some more and come back if i find anything else.

thanks for confirming at least that there is not some invisible code in there i could not see!
easilyi is offline   Reply With Quote
Old 10-23-2004, 12:16 AM   #4 (permalink)
easilyi
Registered User
 
Join Date: Aug 2004
Location: USA - West Coast
Posts: 9
easilyi is on a distinguished road
Well, it was the correct page. I triple checked. The frustrating thing is that all I did was create a new table called prefix and changed that code from wp_prefix to prefix and now it seems to be fine.


I wish I new what caused it. Oh well, I guess it will just be a mystery.

Thanks.
easilyi is offline   Reply With Quote
Old 10-24-2004, 07:53 PM   #5 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
You don't think you have a injected packet in the old DB causing the issue do you?

What is getting inserted anyways?
__________________
Network Synapse
Screaming Electron
Kernel_Killer is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cant connect to mysql databases using php eran PHP 11 08-07-2004 08:02 AM
PHP code for Login Screen KEEBOD PHP 2 07-15-2004 05:18 PM
Help with setting up mySQL and PHP Ilya020 PHP 11 03-19-2003 05:10 AM
HTML form preview then INSERT using PHP & MySQL SteveSoler PHP 5 07-07-2002 09:54 AM


All times are GMT -8. The time now is 02:24 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting