Hey, I'm trying to determine if a table already exists in mysql, but doing a query first with mysql_query, then checking $sql as if it a were TRUE of FALSE. Which I though it would be. My Code always skips to the }else{ statment after the If(). What is wrong, How I do this?
I could of sworn I've wrote other scripts using this and it works.
PHP:
//Check first if it exists
$sql = mysql_query("SELECT var FROM fake WHERE token='{$token}'");
if( ! $sql){
// Does not exist! Create it.
$sql = mysql_query("INSERT INTO fake (var,token) VALUES('$var','$token')") ;
} else {
//It exists, Update it.
$sql = mysql_query("UPDATE fake SET var='{$var}' WHERE token='{$token}'") ;
}
Also
echo $sql; prints out, Resource id #11 or something.. Doesn't seem to say false or true....
PHP code for a proxy
I was wondering which function I could use to create an online proxy tool. I was thinking cURL would work, but it just doesn't seem appropriate, for cURL is mostly used form getting data. Any ideas?
php forms and database navigatio
Hello,I'm new to php and i'd like to post the following.I have written code to get records from a DB and i need one record at a time to be filled in a form i created. Then the next record should be
CU&UC guide
Hi Gurus,
question about n
I was looking at some of the things you could do with php and one of the things I have tried is \n.used this wayCode: [Select]while(list($key, $val) = each($myArray)){ echo "$key =>
Checking if multidimensional array is empty?
I have a for with multiple test input fields. Specifically the user submits multiple names and ages. The form is submitted using the POST method. Here is a code snippet:Code: <form action =
redirect standard error and assert (how to?)
How do you redirect standard error and assert?---(Why? I am creating an web app and assert does not show on the webpage. I do not think standard error does either. Not sure, but fairly certain.
Are sessions secure at all?..
I haven't really gotten into yet, but I was just thinking of something weird..Lets say you have a session element $_SESSION['is_admin']..Is that easy to modify the cookie or whatnot and change it to
MII Netweaver Server stopped due to CPIC connection Problem
Dear Experts,
list files from folder, only one for each date
I have many files in a folder and wish to only list one of each datethese are the file names.date format (dd/mm/yyy)abc - 12-01-2009 - something.pdfabc - 12-01-2009 - something else.pdfabc -
Displaying Column Names
I have a question regarding the ability to show the column names from my table/query.What I'm looking to do is to be able to have my users enter their own query via a builder (Which I haven't built