|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this 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
|
|||
|
|||
|
store image locations in mysql db for gallery
Hi,
I've written a script that resizes and stores 3 versions of the same image to use in a gallery for a flash site I'm building. I've got the uploading working fine and now I'm trying to store the locations of each image (big, preview and thumbnail) in a mysql table so I can retrieve them using php and send them to flash as xml. I've created my db and table but I can't seem to get the info into the database. my mysql set up sql is: PHP Code:
My php for storing the images is: PHP Code:
Everytime I try running the script all the images are sized and stored fine but the mysql query always fails, anyone got any ideas why ?? Thanks in advance, Jon |
|
#2
|
|||
|
|||
|
One or two things stand out. Why on earth do you use @ in front of all mysql statments without the needed (OK prefered) or die("msg") at the end? This way if an error occures, you are not notified. Try it this way:
PHP Code:
Use this function or die() with all of your attempts with SQL (connect, select_db, query and so on). Involving query: I prefer to use ' ' around all of the values I pass along with the query. Let me explain. PHP Code:
It has never failed me. Try your script with the suggested or die() function and see if any error mesages pop up. If they do paste them here. P.S.: I apologize for my disability to write correct in english. Last edited by _rainbow_ : June 23rd, 2003 at 09:41 AM. |
|
#3
|
|||
|
|||
|
got it!
Thanks rainbow, that was it. Now on to the next dilema. I want to be able to edit the captions (but not image locations) of each row and also be able to delete an entire row, how would you reccomend going about this ??
I've written a deleteimage.php script ... PHP Code:
and I was thinking of calling this by first querying the db and outputing a list of links which called the deleteimage.php?ID=5 is this the right idea ??? I'm thinking I should have 2 links for each row, edit and delete, what do you think ?? Thanks, Jon |
|
#4
|
|||
|
|||
|
That's about right. You actually don't need LIMIT 1 at the end of your DELETE statement. You use it only if you have several images with the same id, but that's not supposed to happen, right
![]() All you have to do now is to write the UPDATE SQl statement correct and you're almost done. I see that you have missunderstood me (did I spell this right) regarding single quotes around variables you send with your query. I ment it like this: PHP Code:
Clear now? Another thing: why did you set up your query twice? Once is enough. Probably (this is defintely spelled wrong ) just a wrong copy+paste ![]() |
|
#5
|
|||
|
|||
|
getting SQl errors
cheers,
noticed the duplicate $query var, have deleted. I'm getting errors though when I call the deleteimage.php?ID=whatever script... PHP Code:
here's my script... PHP Code:
Any ideas why ?? Also, what is the syntax to update a column in a specific row in mysql ?? Your spelling's been fine mate! Thanks, Jon |
|
#6
|
|||
|
|||
|
oops
Sorry, should've read your post properly, removed the quotes from gallery and imageID and now it works fine, thanks.
PHP Code:
Now it's onto the editcaption script, any help / pointers would be great. thanks again, Jon |
|
#8
|
|||
|
|||
|
SQl probs
Hey man, Still having probs, could you take a quick look at this and let me know where I'm going wrong. The errors I'm getting are: PHP Code:
PHP Code:
|