News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Adding pic into mysql *updated 2/2/04

Started by Doh004, January 30, 2004, 10:22:53 PM

Previous topic - Next topic

Doh004

Yea um my host did a repair of its server and somehow my mysql is all gone. My forums are gone, my download manager that i was making is gone, my guestbook, my hosted sites forums... Anything that had to do MYSQL.

I've contacted my host however is there anyway to get back my information? As of right now I'm really depressed from losing all the work that I put into it.

And I accept my stupidity for not making a backup of my mysql. The thought never occured to me :(

Chris Cromer

Sorry, but if there is no backup then there is no way to get the data back.
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

Tyris

chances are your host has a backup that might be a week or so old... but myeh...
its probably worth backing up your databases every week or so yourself...

Fizzy

Sorry to hear that Doh  :(

Depending on how big the DB is etc and what sort of Control Panel you have on the server you could run regular back ups puttng the file to the sites directory and every few days or so do a full backup download on to your PC.

Let's hope that the server host has a backup on file
"Reality is merely an illusion, albeit a very persistent one." - A.E.


Spaceman-Spiff

your host should've done backups before fixing/upgrading the server... :-\
hope they still have any backups that aren't old...

Doh004

Hehe yea uhhh well err...

Turns out its all okeydokey now. I just was a little PO'd and never thought that they would come back. But they did...

Now lets all just laugh at my stupidity and call it a day....
*hears laughter as doh walks away slowly*

;)

Fizzy

Glad to hear it's asll sorted Doh  ;D

I learned the same lesson thanks to a "practical joke" on YaBBSE - the less said about that the better  :-\
"Reality is merely an illusion, albeit a very persistent one." - A.E.


Doh004

#7
Lol yep.
<?php
if (($_FILES['uploadedfile']['type'] == 'image/x-png') &&
($_FILES['uploadedfile']['size'] <= '50000'))
{
copy($HTTP_POST_FILES['uploadedfile']['tmp_name'],
    $HTTP_POST_FILES['uploadedfile']['name']);

include (
"dbconnect.php");
$result = mysql_query('SELECT from roms_snes WHERE rom_id = '. $id);
$result2 = mysql_query('UPDATE roms_snes SET ss_1= '. $HTTP_POST_FILES['uploadedfile']['name'] .' WHERE rom_id = '. $id .');
}
else
{
echo '
Didn't work';
}
?>

Anyone see whats wrong with this code?

Thanks

morph

Quote from: Doh004 on January 31, 2004, 05:12:46 PM
Lol yep.
<?php
if (($_FILES['uploadedfile']['type'] == 'image/x-png') &&
($_FILES['uploadedfile']['size'] <= '50000'))
{
copy($HTTP_POST_FILES['uploadedfile']['tmp_name'],
    $HTTP_POST_FILES['uploadedfile']['name']);

include (
"dbconnect.php");
$result = mysql_query('SELECT from roms_snes WHERE rom_id = '. $id);
$result2 = mysql_query('UPDATE roms_snes SET ss_1= '. $HTTP_POST_FILES['uploadedfile']['name'] .' WHERE rom_id = '. $id .');
?>

Anyone see whats wrong with this code?

Thanks

Yes... There is no closing }

Coming soon!

Doh004

I saw that and it still doesnt work...
<?php
if (($_FILES['uploadedfile']['type'] == 'image/x-png') &&
($_FILES['uploadedfile']['size'] <= '50000'))
{
copy($HTTP_POST_FILES['uploadedfile']['tmp_name'],
    $HTTP_POST_FILES['uploadedfile']['name']);

include (
"dbconnect.php");
$result = mysql_query('SELECT from roms_snes WHERE rom_id = '. $id);
$result2 = mysql_query('UPDATE roms_snes SET ss_1= '. $HTTP_POST_FILES['uploadedfile']['name'] .' WHERE rom_id = '. $id .');
}
?>

morph

well look at the following query's ...

$result = mysql_query('SELECT from roms_snes WHERE rom_id = '. $id);
$result2 = mysql_query('UPDATE roms_snes SET ss_1= '. $HTTP_POST_FILES['uploadedfile']['name'] .' WHERE rom_id = '. $id .');

I noticed how one has ' . $id); and the second has ' . $id . '); ... Could be a problem there?

edit.. dont forget to parse out the ' in don't..

else
{
echo 'Didn\'t work';
}
?>

Coming soon!

Doh004

And I didnt have my password correct in my dbconnect.php ;)

umm. My script is supossed to add the url of the pic into the mysql...

I gotta look into that...

Doh004

#12
Here's what i got and now its reading that theres a column with the uploaded files' name:
Unknown table 'png' in field list

heres what i have:
<?php
$default
= "news";
if(
$id == ""){$id = $default;}elseif(isset($id)){$id = $id;};

if ((
$_FILES['uploadedfile']['type'] == 'image/x-png') &&
($_FILES['uploadedfile']['size'] <= '50000'))
{
copy($HTTP_POST_FILES['uploadedfile']['tmp_name'],
     $HTTP_POST_FILES['uploadedfile']['name']);

include (
"dbconnect.php");
$result = mysql_query('SELECT * FROM roms_snes WHERE rom_id = '.$id)
or die(mysql_error());
$result2 = mysql_query('UPDATE roms_snes SET ss_1= '. $HTTP_POST_FILES['uploadedfile']['name'] .' WHERE rom_id = '. $id)
or die(mysql_error());
}
?>

morph


<?php
global $HTTP_POST_FILES;
$default = "news";
if(
$id == ""){$id = $default;}elseif(isset($id)){$id = $id;}

if ((
$_FILES['uploadedfile']['type'] == 'image/x-png') && ($_FILES['uploadedfile']['size'] <= '50000'))
{
copy($HTTP_POST_FILES['uploadedfile']['tmp_name'],
   
$HTTP_POST_FILES['uploadedfile']['name']);

include ("dbconnect.php");
$result = mysql_query("SELECT * FROM roms_snes WHERE rom_id = $id") or die(mysql_error());

while($row = mysql_fetch_assoc($result)) //could use mysql_fetch_array also.. right?
{
$result2 = mysql_query("UPDATE roms_snes SET ss_1= $HTTP_POST_FILES['uploadedfile']['name'] WHERE rom_id = $id") or die(mysql_error());
}
}
?>


Did you forget to add a global in there? also try this.. I played around with it. Also, it could be a SQL problem (no table name..)

Coming soon!

Doh004

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/dohgames/public_html/roms/ss/savefile-snes.php on line 16

:-\

morph

#15
Quote from: Doh004 on January 31, 2004, 06:28:24 PM
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/dohgames/public_html/roms/ss/savefile-snes.php on line 16

:-\


heh... whoops. Hm give me a few.

replace the second query with this..

$result2 = mysql_query("UPDATE roms_snes SET ss_1= $HTTP_POST_FILES[uploadedfile][name] WHERE rom_id = $id") or die(mysql_error());

Coming soon!

Doh004

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '[name] WHERE rom_id = 1' at line 1
:'(

Doh004

Please help anyone. *makes puppy dog face* ;)

morph

Hmpf... Sorry. Maybe I should work more with my php before trying to help  :-\

Coming soon!

Doh004

I'm gettign my else now:
<?php
$default
= "news";
if(
$id == ""){$id = $default;}elseif(isset($id)){$id = $id;}

if ((
$_FILES['uploadedfile']['type'] == 'image/x-png') && ($_FILES['uploadedfile']['size'] <= '50000'))
{
copy($HTTP_POST_FILES['uploadedfile']['tmp_name'],
   
$HTTP_POST_FILES['uploadedfile']['name']);

include ("dbconnect.php");
$result = mysql_query("SELECT * FROM roms_snes WHERE rom_id = $id") or die(mysql_error());
$result2 = mysql_query("UPDATE roms_snes SET ss_1=$HTTP_POST_FILES[uploadedfile][name] WHERE rom_id = $id") or die(mysql_error());
}
else
{
echo
'Hahaha didnt work';
}
?>

Advertisement: