|
Web design and Programming Discuss website creation and other programming topics. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||
|
PHP/MySQL
Hey everyone, i've started getting into minor php and mysql but i'm having some troubles.
http://www.exit-thirteen.com I'm using mysql tables to hold all the info for my site... but i want to setup a form so that i can edit what has already been posted. How do i approach this? My table rows are: postID (not shown on webpage) postTITLE <- the message's title posterNAME <- now used for user input date postTIME <- database time (not shown on webpage) postTXT <- the message |
#2
|
||
|
fetch all the mysql data for a given row and array it
$getnews=mysql_fetch_array(mysql_query("SELECT * FROM whereever WHERE id='1'"); that puts the returned data into an array, accessable by $getnews[fieldname] (postTXT, postTIME etc) You could just straight away use the array varibales to poulate a HTML form using the HTML value, and if its just you then you could do this, but it would be an idea to stripslashes, nl2br etc etc to do it properly... I think anyway, p would be more help... |
#3
|
||
|
Alot of people have had very good success learning the basic functions of php by downloading my simple squad site.. it was one of the first scripts I ever wrote so it's pretty basic and easy to follow.
Mikes way above will work except there is one ")" missing at the end of the query, it should look like this: $getnews=mysql_fetch_array(mysql_query("SELECT * FROM whereever WHERE id='1'"));
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#4
|
||
|
Probably help if i posted a link to my script:
http://www.phphq.net/scripts/SimpleSquadSite-v1.2.zip
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#5
|
||
|
Its actually your way (well, everything except the missing )), i learnt it of SSS, would have posted a link but didnt know you offered it for download
|
#6
|
||
|
I wrote a basic script for you and anyone else that wants to learn.. It all starts from there, at least for me. Basic mysql select, display, delete, modify querys. It's not been debugged so there might be a few phrase errors..
I think you already know how to select data to be displayed but for anyone else that is wondering this is how it would be done following the script attached.. If your wondering what a function does look at http://www.php.net, enter the function name in the search box and read a little, it's extremly well documented, also read the user contributed notes as they help ALOT. PHP Code:
Note, you will have to right click and view source to see the attached document in it's php form correctly..
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#8
|
||
|
Theres also good info on php.net, thats where i lernt it hehe
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PHP and mySql | atholon | phphq.Net Forums | 1 | 07-16-2008 01:25 PM |
MySQL Problem or PHP? | Webviper2006 | Web design and Programming | 3 | 12-26-2005 12:17 AM |
php/mysql problem need help | G.I.JOE*MFA* | Web design and Programming | 3 | 02-09-2004 05:20 PM |
PHP, MySQL | REGULATOR | Web design and Programming | 7 | 11-22-2003 11:53 AM |
php and mysql | XenoMorpH | Web design and Programming | 4 | 04-01-2003 06:14 AM |