Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
[SOLVED] submitting multiple entries into a sql database
Maq replied to sudsy1970's topic in PHP Coding Help
1) You need to specify what fields you're inserting into BEFORE the VALUES. 2) The POST calls are the wrong syntax (you need to take out the periods). 3) You're not executing the mysql_query. 4) I think your code looks very sloppy, let me help you out. $Firstname = $_POST['Firstname']; $Surname = $_POST['Surname']; $Email = $_POST['Email']; $Dob = $_POST['Dob']; $Password1 = $_POST['Password1']; $User = $_POST['User']; mysql_query("INSERT into users (Firstname, Surename, Email, Dob, Password1, User) VALUES ('$Firstname', '$Surename', '$Email', '$Dob', '$Password1', '$User') ") or die(mysql_error()); Please check out this tutorial on the basics on INSERT, Tizag - INSERT -
You should check to see if that user ID exists in the table already because if they haven't reached the time limit then you're trying to insert into an ID that's already there. So: 1) Check to see if user is in the $tbl_online (by id). 2) If they are then UPDATE their time and w/e else you need to update. 3) If they aren't then you should insert them (proceed with your current code). Hope this helps!
-
Then you can check to see if the user has the cookie names "yes" with the isset... Use the example I provided you.
-
I found this for you, very basic...
-
I generally don't use quotes because some other dialects of SQL don't use backticks. For example, MSSQL uses []. Every now and then I've had to change the DB type, and removing all of the ` is just a waste of time when they're not needed to begin with. Thanks for the info. So it's good practice NOT to use backticks for portability purposes?
-
Actually, the field names don't need any quotes... Sorry bout that. But it is good practice to use the back ticks like burnside used.
-
PLS HELP! PHP not showing <include> page
Maq replied to sushiking's topic in PHP Installation and Configuration
I found on the Drupal forums a similar problem and they fixed it by: Hope this helps! -
Please echo out $name and $theme to make sure they are the correct values. Also, make sure "name" and "theme" are field names. mysql_query("INSERT INTO `interactive` ('name', 'theme') VALUES ('$name', '$theme'")) or die (mysql_error());
-
PLS HELP! PHP not showing <include> page
Maq replied to sushiking's topic in PHP Installation and Configuration
Code? -
Out of curiosity, are these pages using PHP? Cause it would be so much easier, and easier for me to answer. Example: if (isset($_COOKIE["yes"])) echo "Cookie exists! "; else echo "Cookie does not exist... "; ?>
-
Curious, which one?
-
$date = strtotime($row['date']); $date_format = date("m/d/y H:i:s A", $date); Not tested.
-
question on SEO and database-driven site integration...
Maq replied to mac007's topic in PHP Coding Help
Just remember engine crawlers see your site the way you do. There is a mod_rewrite to accomplish this which is SEO friendly. There are many threads already started on this topic (and I think a sticky as well). Yeah, read the SEO sticky and threads that have to do with your topic. Almost all these questions have been answered a multitude of times. If you have specific ones, like how to use mod_rewrite for your own URL please post it so we can help. -
What makes you think there is a efficient way? Is your script slow? Does it look bad? What is the reason for you posting here? Do you have any theoretical ideas that you think may be better?
-
Could you explain what this is supposed to do rather than me reading through your code and guessing?
-
You need to compile and store what has been clicked on. Right now if you click submit, there's nothing to send... An easy way to do this is when a button is clicked store the values in a string delimited by a comma so now you can pass the whole string, explode it, and have case statements for your operators in process.php. You could actually do it all on the same page. Have a function that takes in a string and when submit isset call the function and return the calculation. Of course you're going to have to validate, but let's get it working first. Next time add some detail/research to your question. Something like:
-
I'm assuming he's already started one.
-
That is a very poor explanation. But anyway, I see 6 forums...
-
Just like when you have a session variable and you assign an ID to it, not everyone has that id... All you have to do is call session_destroy() whenever you want to end that users session.
-
By post, do you mean you have some sort of forum? All this information should be stored in a databse. I still don't understand exactly what you're trying to do. If you want to share data than just store the info in a database and have both servers connect to it.
-
First of all this is a bad section to post in... Second, what fields are working, what aren't? For starters instead of using REQUEST use the POST method like you state for your method in your HTML. You should be concatenating/formatting the body into 1 variable to pass through... Right now you have $ans & $ans2, which I don't think will work properly. # $sent = mail($to, $subject, $ans, $ans2, $headers) ;
-
How do I increase display font size in phpBB 2.0?
Maq replied to HowdeeDoodee's topic in Applications
You would have much better luck posting in the PHPBB community forums but you would have to find the CSS files as to what you want to change. -
Try this, it's annoying trying to deal with escaping the strings, I like to just assign them to another variable. Also, like zenag said, add mysql_error() on the end of your die function so it can give you a descriptive error message. $mem_id = $_SESSION['member_id']; $rem_add = $_SERVER['REMOTE_ADDR']; $php_self = $_SERVER['PHP_SELF']; $insert = mysql_query("INSERT INTO $tbl_online (id, timestamp, ip, file, ol_user, ol_id) VALUES('$mem_id', '$timestamp', '$rem_add', '$php_self', '$ol_user', '$ol_id')") or die("Error in who's online insert query!".mysql_error());
-
We would need to see the profile page to help you there. When you display each name you have to look it up against the database and see if they're online. $result = mysql_query("SELECT ip FROM $tbl_online WHERE user_name = $user_name") or die("Error in user online result query!"); if(mysql_num_rows($result) > 0) { //display the online_image } else { //display the offline_image }
-
session_destroy();