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!
function edit_proof()
{
$editproof = "SELECT id FROM ".$glob['dbprefix']."HNGH_editproof WHERE id >0 ORDER BY RAND() LIMIT 1";
$edit_results= mysql_query($editproof);
$editproofs = $edit_results[0]['id'];
return $editproofs;
}
$editproof_id = edit_proof();
print ("$editproof_id")
Could it be the way I am calling it on another page
Ignoring the lack of quotes around "editproof.php," $glob won't exist to your edit_proof function. Maybe you want $GLOBALS['dbprefix'] or something similar?
Thank you. I have the quotes around ("editproof.php") and the semicolon on the actual page.
I tried the suggestions for globals including just using the db prefix (lhngh_one) but nothing returns from the db. I added the "HERE'S------" to the print line
to make sure that something was coming back and all I get on the page with "include_once" is "HERE'S------"
Depending on the numberous configurations occationally I get "S" (BTW, what is that "S"?). Could it be the way I am making the query? Is " mysql_query" the right usage?
I'm not sure of what you're talking about with "S"
As for the code, I don't see anything popping out that's wrong with the query or your calls provided your variable insertion works. Have you tested that you can get the variable correctly?
Maybe you need to (or rather should) pass it into the function.
Yes. I can get the variable (actually variables but if I can just get one via the function I will be happy). I'm just having problems with the query et al. as a function.
I was having a good time making it work (as just a query) the way it was supposed to until, because it is a random query, each time I used a variable on the same page I would get a different response and I need one random response per page load/reload. I looked around and saw that a function might be the way. If I can get one random result, I can use switches and other queries to get the rest of the information.
Oh, I get "S" often usually right after a" Resource id #" error. I'll try to "create" one
I've finished this $#*!* site (at least the big programming)! I'm going to out into the world!! I haven't been out all summer!! I'm going to pig-out at Pizza Hut's 'All You Can Eat' buffet. I'm going to see "Snakes on a Plane"!!!!
All I had to do is leave out the ... and use a single quotation mark. Well here is the line
I've finished this $#*!* site (at least the big programming)! I'm going to out into the world!! I haven't been out all summer!! I'm going to pig-out at Pizza Hut's 'All You Can Eat' buffet. I'm going to see "Snakes on a Plane"!!!!
I'm FREE!!!!!
Ahhhh. I feel warm inside now.
Enjoy man!
Snakes on a plane == good stuff
I haven't been out all summer
Nah well most of us here are allergic to that solar thing ewwigh... it hurts me.