sumfight Posted June 6, 2008 Share Posted June 6, 2008 Here is the code I have to show the pictures once they are uploaded <?php $host=""; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name=""; // Database name // Connect to server and select databse mysql_connect("$host", "$username", "$password")or die("cannot connect to server"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * from images ORDER BY rand() LIMIT 1 "; // choose limit of pictues to be displayed $result=mysql_query($sql); ?> <table width="95%" border="0" cellpadding="3" cellspacing="3" style="padding-top:5px"> <tr> <?php $i=13; // always 1 more than limit while($rows=mysql_fetch_array($result)){ $i = $i - 1; if($i % 2 == 0) { ?> </tr> <tr> <?php } ?> <td align="center" valign="top"><table border="0" align="center" > <tr> <td align="center"><img src="<?php echo $rows['image']; ?>" alt="<?php echo $rows['name']; ?>" border="0"/></td> </tr> <tr> <td align="center" valign="middle"><a href="<?php echo $rows['link']; ?>"><?php echo $rows['name']; ?></a></td> </tr> </table></td> <td> <?php } ?> </td> </tr> </table> Now I want to know if someone can help me create a form so users can upload the picture to a folder and puts the path to the image in the database? Link to comment https://forums.phpfreaks.com/topic/109042-got-the-database-code-need-help-with-upload-form/ Share on other sites More sharing options...
amites Posted June 6, 2008 Share Posted June 6, 2008 give this a shot and let me know if you need help with anything specific http://www.google.com/search?q=upload+image+php&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a Link to comment https://forums.phpfreaks.com/topic/109042-got-the-database-code-need-help-with-upload-form/#findComment-559400 Share on other sites More sharing options...
sumfight Posted June 6, 2008 Author Share Posted June 6, 2008 I spent two more hours trying to figure it, I have no clue what is going on, but thank you for the help anyways Link to comment https://forums.phpfreaks.com/topic/109042-got-the-database-code-need-help-with-upload-form/#findComment-559457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.