devang23 Posted December 5, 2009 Share Posted December 5, 2009 Hello, I am having trouble with a script. I'm pretty sure it is correct, but it keeps shooting me a syntax error "t_variable" im not sure what that means. All im tryna do is, setup a site which information can be entered, and i want that info to go to a table in mysql....and it just wont work....any suggections Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/ Share on other sites More sharing options...
rajivgonsalves Posted December 5, 2009 Share Posted December 5, 2009 thats a syntax error so it basically means that your syntax is not adhering to the php syntax, if you can show some code it would be helpful, cannot say much without that. Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/#findComment-971947 Share on other sites More sharing options...
devang23 Posted December 5, 2009 Author Share Posted December 5, 2009 <html><head><title>Adding a User </title></head> <body> <?php if( (!$firstname) or (!$lastname) or (!$username) or (!$password) ) { $form ="Please enter all new user details"; $form.="<form action=\"$PHP_SELF\""; $form.=" method=\"post\">First Name: "; $form.="<input type=\"text\" name=\firstname\""; $form.=" value=\"$firstname\"><br>Last Name: "; $form.="<input type=\"text\" name=\"lastname\""; $form.=" value=\"$lastname\"><br>UserName: "; $form.="<input type=\"text\" name=\"username\""; $form.=" value=\"$username\"><br>PassWord: "; $form.="<input type=\"text\" name=\"password\""; $form.=" value=\"$password\"><br>"; $form.="<input type=\"submit\" value=\"Submit\">"; $form.="</form>"; echo($form); } else { $conn = mysql_connect("mysql4.000webhost.com")or die("Try Again Punk"); $db = mysql_select_db("a3213677_snorre",$conn)or die("NOOPE") $sql = "insert into User Table(first_name,last_name,user_name,password) values(\"$firstname\",\"$lastname\",\"$username\",password(\$password\") )"; $result = mysql_query($sql,$conn)or die ("NOT EVEN"); if($result) { echo("New User $username ADDED DUH!"); } } ?> </body></html> LINE 24 has the problem Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/#findComment-971953 Share on other sites More sharing options...
rajivgonsalves Posted December 5, 2009 Share Posted December 5, 2009 your missing the semicolon at the end of the previous line Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/#findComment-971955 Share on other sites More sharing options...
devang23 Posted December 5, 2009 Author Share Posted December 5, 2009 your missing the semicolon at the end of the previous line nope, same thing...ive adjusted it several times and still the same syntax error everytime Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/#findComment-971958 Share on other sites More sharing options...
rajivgonsalves Posted December 5, 2009 Share Posted December 5, 2009 I tried out the code it seems to work when I added the semicolon at this line ? $db = mysql_select_db("a3213677_snorre",$conn)or die("NOOPE"); Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/#findComment-971961 Share on other sites More sharing options...
devang23 Posted December 5, 2009 Author Share Posted December 5, 2009 I tried out the code it seems to work when I added the semicolon at this line ? $db = mysql_select_db("a3213677_snorre",$conn)or die("NOOPE"); ] i copied and pasted what u just sent me....and now its giving me a t_string....everytime i change it theres a new syntax Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/#findComment-971964 Share on other sites More sharing options...
PFMaBiSmAd Posted December 5, 2009 Share Posted December 5, 2009 Where are you testing this? A local PC? Live web hosting? Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/#findComment-971966 Share on other sites More sharing options...
devang23 Posted December 5, 2009 Author Share Posted December 5, 2009 Where are you testing this? A local PC? Live web hosting? yea its webhost, and its has a server/database of its own with a mysql, and i want this info to go into the mysql tables, and for some reason i dont know what im doing wrong cause ive tried many times Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/#findComment-971969 Share on other sites More sharing options...
fenway Posted December 5, 2009 Share Posted December 5, 2009 If you're talking about php syntax, this is the wrong place. Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/#findComment-971975 Share on other sites More sharing options...
PFMaBiSmAd Posted December 5, 2009 Share Posted December 5, 2009 Live web servers often have disk caching setup with long TTL (time to live) settings that prevent checking for file changes. You would need to output no caching settings for all your files and then wait for the cache to be cleared out so that the no caching setting applies. You should be learning php, developing php code, and debugging php code on a local development system. You will save a ton of time in the development cycle. Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/#findComment-971977 Share on other sites More sharing options...
devang23 Posted December 5, 2009 Author Share Posted December 5, 2009 Live web servers often have disk caching setup with long TTL (time to live) settings that prevent checking for file changes. You would need to output no caching settings for all your files and then wait for the cache to be cleared out so that the no caching setting applies. You should be learning php, developing php code, and debugging php code on a local development system. You will save a ton of time in the development cycle. i have a small company, and all i want is a basic thing that sends info to that database....theres no way i can fix this? there are no cache settings on webhost. is there a different possible code i can use to relay simple information from website to a datebaste Quote Link to comment https://forums.phpfreaks.com/topic/184102-hello-i-am-completely-lostneed-help-with-php-and-mysql/#findComment-971981 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.