-
Posts
279 -
Joined
-
Last visited
Never
Posts posted by vicodin
-
-
Ok so im trying to make a script that grabs the basename of a file in windows. It will always be run locally on the machine so when i used the function it is messing up. Im guessing it has something to do with the space?
Example:
$path="C:\Documents and Settings\office\Desktop\Web Design\CSVtoJPG Rename\test.txt"; echo basename($path);
Output is: CSVtoJPG Rename est.txt
Any help anyone?
-
Which one would i use... never used mysqli before.
-
Is there an email client you have gotten it to work in?
-
Ok so i am looking to make a function that is capable of updating multiple MYSQL rows.
Not sure how i would do this. I know how to make one for a single update but having trouble with making a function do multiple row updates.
Example : Lets say i have row category and row category_name.
I want a function that will allow me to do this.
function UpdateDB($table,$rows,$updates,$where,$where_row_equals)
Pretty much when i execute it i would like to be able to do this...
UpdateDB("mytable","category,category_name","10,MyCatName","category","10");
Any help would be greatly appreciated.
P.S. Where i am having problems is the mysql syntax needs to be
"SET $row1 = $update1 $row2 = $update2" and so on.
-
Ok found the issue... im just a moron and didnt think it was the other MYSQL statement that was in the script but it was... Thanks for all your help!
-
WayneWex it gave the same Error ... mjdamato i will do that now and let you know what happens.
-
I am getting a MYSQL Syntax error. I cant figure out what is wrong... can anyone help?
mysql_select_db("MyTable") or die(mysql_error()); mysql_query("UPDATE products SET cat = '{$cat}', subcat = '{$subcat}', proname ='{$pname}', model = '{$model}', prodes ='{$pdes}', proid ='{$pid}', keywords ='{$pkey}', specs ='{$pspec}' WHERE proid = '$pid' ") or die (mysql_error());
Error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'products WHERE proid = '10057'' at line 1
-
i went this way...
$date = "2008/08/28"; $date = substr($date,0,4);
thanks for the reply though.
-
lol sorry i meant i just want the 2008 out of the 2008/08/27 ...
-
i could be wrong but it looks like you are trying to run that function on a directory instead of a file. Thats what i am seeing but i could be wrong.
-
Hello all... I am going to have the following format of time in my db. I would like to just be able to get the time out of it... How would i do that?
Date Format: 2008/08/27
-
Make sure start_session() is the very first thing... make sure there are no space or anything before it.
-
Ya i saw that after i posted... fixed it though... No that one is closed its the one after the else...
include "connect.php"; // Checks the database for a user with a particular user name $check = mysql_query("select ID from users where username='$username' limit 1;"); // get a row count of the number of rows found if(mysql_num_rows($check) == 1) { echo "Username Already In Use."; } else { <----- ***This one is not closed***
My code above should fix the issue
-
This should do it.
<?PHP include "connect.php"; // Checks the database for a user with a particular user name $check = mysql_query("select ID from users where username='$username' limit 1;"); // get a row count of the number of rows found if(mysql_num_rows($check) == 1) { echo "Username Already In Use."; } else { if(isset($_POST['submit'])) { $username=$_POST['username']; $password=$_POST['password']; $email=$_POST['email']; if(strlen($username)<1) { print "You did not enter a username."; } else if(strlen($password)<1) { print "You did not enter a password."; } else { $insert = "INSERT INTO `users` (username,password,email) VALUES ('".mysql_real_escape_string ($username)."','".mysql_real_escape_string ($password)."','".mysql_real_escape_string ($email)."',".mysql_real_escape_string; mysql_query($insert) or die("Could not insert comment" . mysql_error()); echo "User Added. <a href=\"home.html\">Click here</a> To Go Home."; } } } ?>
-
Hello all i am trying to compare dates and find out if the person signed up this month or before this month. So i came up with this and it works but was wondering if there was a better way to do it.
$signup = "2008-10-09";//<-- What ever date is pulled from DB $date = date("Y/m"); $date.= "/01"; $date = strtotime($date); $signup = strtotime($signup); if ($signup > $date){ echo 'Signed Up This Month'; } else { echo ' Signed Up Before'; }
-
Try:
$_SESSION['var'] = 'Hello World';
So instead of " use ' ...
Make sure you have session_start() on all your pages that will be in the session.
-
Got it... Thank you!
-
Hello all, lets say i have some users and when they made their account the made the username: John Doe. now they go to sign in and they type in john doe instead of John Doe. Will MYSQL see it the same either way? If not how can i make it so MYSQL will get it the same everytime but i also want their name to be to show up on the site the same way they made it when they registered?
-
Your missing some brackets....
if (date("U") > date("U", mktime(12,0,0,date("F"),date("d"),date("Y")))){ header("Location: /afternoonschedule"); } else { header("Location: /morningschedule"); }
-
NULL
in MySQL Help
Hello all, I am not all that great with MYSQL but i was just wondering something... Usually if i am storing a true or false value in to my db i just have it a 0 or a 1. Instead of having MYSQL look for a 1 or 0, would it be better or faster to start using IS NULL or IS NOT NULL in my statements?
-
Ok cool... Thanks
-
Ok i have a script db.php which is all my db connection info. Can i put:
mysql_select_db("MyDB") or die(mysql_error());
in that db.php file as well so i dont need to call it with everyone of my functions(as long as i am selecting the same db) or should i call it with every function?
-
Never done this my self but i do know if you dont want the page to refresh then your gonna have to use AJAX as well. I would start looking for AJAX tutorials there should be some on this.
-
True... good call.
First time with MySQL
in PHP Coding Help
Posted
step1. you can find php_mysqli.dll
step2. and put that dll into c:\php\extensions\
step3. that folder is not available, create it. now our dll file is in c:\php\extensions\php_mysqli.dll
step4. go to php.ini, i thought that is in c:\windows
step5. search "extension_dir"
step6. after you found that you can set the path c:\php\extensions
step7. inside the php.ini, go to the dll section (search dll as your text in the search box)
step8. there is something like ;extension=php_mysqli.dll
step9. if it is not available, you type the above thing and remove the semicolan (
step10. save php.ini file and check it out.