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!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I've tried just about everything I can think of. I have a form that posts to this script. It seems to work (I don't get error connecting to mysql) but what I'm doing isnt showing up in the database. I am new to php so it's probably something stupid.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Damn thanks a bunch man. Worked like a charm. I'm still confused about what I use ' for and what I don't but I'm sure I'll get the hang of it.
I have another question if its not too much of a bother...
I want to give all the items in my table an ID number starting from 1 and going up as I insert new rows over time. Is there a built in way to do this or do I have to do it manually from php?
trip272 wrote:Damn thanks a bunch man. Worked like a charm. I'm still confused about what I use ' for and what I don't but I'm sure I'll get the hang of it.
trip272 wrote:I have another question if its not too much of a bother...
I want to give all the items in my table an ID number starting from 1 and going up as I insert new rows over time. Is there a built in way to do this or do I have to do it manually from php?
yeah.. define your MySQL primary key (ID) with feature auto_increment will do the job..
or do in complex way... use a SQL command, which search for the max value of ID column, then +1...
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I've recently started learning PHP & MySQL and a simple way I see of doing it at the moment is:
$numRows = mysql_numrows($DBresults); // Returns the amount of rows currently in the DB //
$myCounter = $numRows + 1; // Adds 1 to the counter for this current record //
//Insert $myCounter as the primary key in the MySQL DB. //
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]