|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hi,
I am having a problem with a php/mysql image gallery that I am working on. These 3 lines of code appear to work but everytime the event_id obtained is equal to 2 which is not the case, the event_id variable in the events_gallery table autoincrements starting at 1 but even with 1 entry in the table the event_id obtained using php is 2. The codes is below... mysql_query ("INSERT INTO events_gallery VALUES ('$add_event_name', '$img_name', null)"); $sql = "SELECT ID from events_gallery WHERE (event_name = '$add_event_name')"; $event_id = mysql_query($sql); If i do the same query through telnet I get the correct values using the same SQL statement that im using in php so i have no idea what the problem is... any ideas? |
|
#2
|
|||
|
|||
|
Ok i put that project on hold and went back to another php/mysql thing i was doing (querying a database for event/info) and ran into another differnt but mayb similar problem. I have dates stored in a mysql database of the form yyyy-mm-dd format and im trying to use the date_format function in mysql to convert them then display the result using php. Ive done this using the following code:
$sql = "select date_format('$temp2','%W %M %D, %Y')"; $temp = mysql_query($sql); print("$temp"); But once again the commands return the proper results when typing the SQL into telnet but the results are "3:" "4:" etc... when called using the code above. I'm not sure what the problem is. Any help would be apprecaited... thanks in advance! |
|
#3
|
|||
|
|||
|
ok, cmatrix, i had the same problem and in the meantime you figured it out and helped me that way. i will tell the solution here if anybody else will get into the same problems.
Use: <?php $temp2 = "2000-01-04"; $sql = "select date_format('$temp2','%W %M %D, %Y')"; $temp = mysql_query($sql); $temp_date = mysql_fetch_row($temp); echo($temp_date[0]); ?> URL credits go to cmatrix, thanx for helping me, yves. |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > php problem? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|