Strange problem while trying to call method.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post by bdlang »

Daedalus- wrote:I thought hard about whether there would be multiple queries at one time. I believe that everything I need to do can be accomplished using JOINs. I had already been thinking about how to fix the function if I did need to make more than one and I figure that I could say something like:

"SELECT * FROM users WHERE name = '$s'; SELECT * FROM images WHERE id = '%d'"
FYI, before you get too wrapped up in that idea, you should be aware that mysql_query() will only allow a single query at a time.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

No no, what I would do is take

Code: Select all

$sql = "SELECT * FROM blah WHERE doody = gross; UPDATE blah SET doody = brown; SELECT * FROM blah WHERE doody = brown";
$sql = explode("; ", $sql);

echo $sql[0]; // SELECT * FROM blah WHERE doody = gross
echo $sql[1]; // UPDATE blah SET doody = brown
echo $sql[2]; // SELECT * FROM blah WHERE doody = brown
You likee?


One thing I forgot to mention. The error that I was having, when I started this thread is still appearing!! Sort of.

The page still dies at the same place, but no error message is displayed. :(

I can post the code if anyone would like, or I can explain what is happening.
Post Reply