
daniel28138
Members-
Posts
19 -
Joined
-
Last visited
daniel28138's Achievements

Newbie (1/5)
0
Reputation
-
AHHHHHHHHHHHHHHHHHH I see now!!! I can identify that the value equals the image, before it goes to display it. Sweet! See I love this site. I'm learning a lot. Thank you very much!!!
-
mac_gyver, my apologies. I never did explain further why I couldnt turn on the stuff to show me more specifically. I searched around but I couldn't seem to be able to duplicate what I saw to do that. I contacted my hosting company about it and they currently have a support ticket to find out why, so I'm waiting on that. Ch0cu3r You are awesome too. I appreciate that. And again, myapologies because I didn't explain further. I actually left out a huge chunk of what I needed. I actually see exactly why you're code works and thats great (It's echo'ing the number in the database and putting it as the beginning of the name of the png file to make it the full name of the image file - though my termonology is prob amateur sounding) The problem is, that there will be times I'll need this script, and the file name will be totally different from that. Another words, I will have pages where I'll use this, where... for example... the number "5" in the column will need to show image "random_image.jpg" or, the number 20 in the column will need to display the image "abottleofwhiskey.gif" etc etc. So I was using this to learn how to do the rest of them. For an example to show how I'm using this to learn, I have the "0" actually needing to display the image "nostar" so, "0star.png", is no image. I hope you all know that I do appreciate the help. I come here after I search and spend many hours trying it, so as to I don't feel like I'm just having someone build my site for me.
-
Oooookay. I think I made progress, but now I'm baffled as to why it only works outside the php I already have.... Here is where the ratings part works. And the second part will explain where I'm trying to put it. <table bgcolor=\"#333333\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\"> <tr> <td> <?php $link = mysql_connect('site', 'db', 'pass'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db(bands); $query = "SELECT * FROM band ORDER BY `Name` ASC"; $res = mysql_query($query) or die(mysql_error()); while ($band = mysql_fetch_array($res)){ // Show images if($band['rating']=='0'){ print "<img src='../ratings/0star.png'/>"; } elseif($band['rating']=='1'){ print "<img src='../ratings/1star.png'/>"; } elseif($band['rating']=='4'){ print "<img src='../ratings/4star.png'/>"; } } // End while loop ?> </td> </tr> </table> <?php $link = mysql_connect('site', 'db', 'pass'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db(bands); $query = "SELECT * FROM band ORDER BY `Name` ASC"; $res = mysql_query($query) or die(mysql_error()); { function makeLinks($text) { $text = html_entity_decode(' '.$text); $text = preg_replace('#(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~\#?&//=]+)#', '<a href="\\1" target=_blank>\\1</a>', $text); $text = preg_replace('#([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~\#?&//=]+)#', '\\1<a href="http://\\2" target=_blank>\\2</a>', $text); $text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', '<a href="mailto:\\1" target=_blank>\\1</a>', $text); $text = str_replace(array("\r\n", "\r", "\n"), "<br />", $text); return trim($text); } while ($band = mysql_fetch_assoc($res)) { echo "<table width=\"30%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" align=\"center\">"; $link = makeLinks($band['website']); $description = makeLinks($band['Description']); echo "<tr>"; echo "<td>"; echo "<table bgcolor=\"#333333\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">"; echo "<tr><td><div align=\"left\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"CCCCCC\" size=\"2\">This Review Is About:</font></br><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"FF6633\" size=\"4\"><b>{$band['Name']}</b></font></br><img src=\"http://www.inthisreview.com/Misc/tablespacersm01.png\"></br><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"CCCCCC\" size=\"2\">Review Posted:</br></font><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"FFFFFF\" size=\"2\"> ".date("F j, Y g:i a", strtotime($band["timestamp"]))."</font> </br><img src=\"http://www.inthisreview.com/Misc/tablespacersm01.png\"></br> <font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"00A0E0\" size=\"2\"><b>ITR Rating:</b></font> // Begin Rating // End Rating </td>"; echo "<td><div align=\"right\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"FF6633\"><img src=\"bandimages/{$band['photo']}\" width=\"300\"> </div></td></tr>"; echo "</table>"; echo "<tr><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"00A0E0\" size=\"2\">Website:</font><span class=\"class5\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">{$link}</font></span></br></td></tr>"; echo "<tr bgcolor=\"#191919\"><td><div align=\"center\"><span class=\"class5\"><font face=\"Verdana, Arial, Helvetica, sans-serif\">{$description}</font></span></div></td></tr>"; echo "<tr>"; echo "<td>"; echo "<table bgcolor=\"#333333\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">"; echo "<tr><td><div align=\"center\"><span class=\"class1\"><font face=\"Verdana, Arial, Helvetica, sans-serif\"><a href=\"modifybands.php?id={$band['id']}\"> Modify Review</a></font></span></div></td>"; echo "<td><div align=\"center\"><span class=\"class1\"><font face=\"Verdana, Arial, Helvetica, sans-serif\"><a href=\"deletebands.php?id={$band['id']}\"> Delete Review</a></font></span></div></td></tr>"; echo "</table>"; echo "</table>"; echo "<div align=\"center\"><img src=\"http://www.inthisreview.com/Misc/tablespacer01.jpg\">"; } } ?> Now... here is the baffeling part. I've tried to ECHO to table so this can be part of the other loop. But as soon as I put it in the rest, I get the dredded 500 error again. If I have it like above, then I can see the script working, but it wont go as it is in the rest of the PHP (Note where I have //Start of rating - // End of rating) without the page error. This is the part (below) that works outside of the php script <table bgcolor=\"#333333\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\"> <tr> <td> <?php $link = mysql_connect('site', 'db', 'pass'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db(bands); $query = "SELECT * FROM band ORDER BY `Name` ASC"; $res = mysql_query($query) or die(mysql_error()); while ($band = mysql_fetch_array($res)){ // Show images if($band['rating']=='0'){ print "<img src='../ratings/0star.png'/>"; } elseif($band['rating']=='1'){ print "<img src='../ratings/1star.png'/>"; } elseif($band['rating']=='4'){ print "<img src='../ratings/4star.png'/>"; } } // End while loop ?> </td> </tr> </table> And I want to get that into between the // Start rating and // End of rating
-
I'd like to add that I am learning a lot mainly from the help I get on this forum. I appreciate it. I added a }else{echo "<img src='../ratings/0star.png'/>";} at the end but it didn't help
-
Ch0cu3r Thank you for the reply. But I think what you have just displays one image. I want it to show the image, based on the number (1 through 5) that is entered in the database. So if 1 is in the database for that row, then it will show 1star.png... if 3 is in the database for that row, then it will show 3star.png... etc. I have the images for each already uploaded.
-
Okay, I thought I had this down to what I'm trying to do. But I can't find where I'm going wrong. I promise I searched the best I could, but I can't find specifically where the error (500) is coming from. This is what I added, without it, I get no error, but I get no echo of what I'm wanting either. echo "<tr><td><div align=\"left\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"CCCCCC\" size=\"2\">This Review Is About:</font></br><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"FF6633\" size=\"4\"><b>{$band['Name']}</b></font></br><img src=\"http://www.inthisreview.com/Misc/tablespacersm01.png\"></br><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"CCCCCC\" size=\"2\">Review Posted:</br></font><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"FFFFFF\" size=\"2\"> ".date("F j, Y g:i a", strtotime($band["timestamp"]))."</font> </br><img src=\"http://www.inthisreview.com/Misc/tablespacersm01.png\"></br> <font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"FF0000\" size=\"2\">ITR Rating:</font> if($band['rating']=='0'){ echo "<img src='../ratings/0star.png'/>"; } elseif($band['rating']=='1'){ echo "<img src='../ratings/1star.png'/>"; } elseif($band['rating']=='2'){ echo "<img src='../ratings/2star.png'/>"; } elseif($band['rating']=='3'){ echo "<img src='../ratings/3star.png'/>"; } elseif($band['rating']=='4'){ echo "<img src='../ratings/4star.png'/>"; } elseif($band['rating']=='5'){ echo "<img src='../ratings/5star.png'/>"; } </td>"; People on here have been great with help, and it's always very much appreciated.
-
The problem was the file path... I shrunk it down and it worked. Hope this thread can help someone else too
-
Wow I really suck at this. I must have put that line all over my page and I'm just getting the 500 error. I think maybe it's time to admit defeat :/ I suppose not everyone is cut out to understand this. Does anyone know where there is this same thing that I have that actually works, that I can use? I've already been at this one page for a week every day and night.
-
UPDATE... it turns out there were permission issues with my hosting. Now I'm getting the error "Sorry, there was a problem uploading your file."
-
Hmmm Thanks for the correction. Yes I see what you meant. But I'm still getting the error. Here is the whole thing I have now... <?php // Connects to your Database mysql_connect("site", "user", "pass") or die(mysql_error()) ; mysql_select_db("bands") or die(mysql_error()) ; //This is the directory where images will be saved $target = "http://www.inthisreview.com/bandsreview/bandimages/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $Name=$_POST['Name']; $website=$_POST['website']; $Description=$_POST['Description']; $timestamp=$_POST['timestamp']; $photo = mysql_real_escape_string(htmlspecialchars($_FILES['photo']['name'])); //Writes the information to the database mysql_query("INSERT INTO band (Name,website,Description,timestamp,photo) VALUES ('$Name', '$website', '$Description', '$timestamp','$photo')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file " . basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>
-
I updated but still getting the same error... here is the update. Mac_Gyver... thanks for the tip, but I don't know how to do that or where the php.ini file is? <?php // Connects to your Database mysql_connect("website", "user", "pass") or die(mysql_error()) ; mysql_select_db("bands") or die(mysql_error()) ; //This is the directory where images will be saved $target = "http://www.inthisreview.com/bandsreview/bandimages/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $Name=$_POST['Name']; $website=$_POST['website']; $Description=$_POST['Description']; $timestamp=$_POST['timestamp']; $photo = mysql_real_escape_string(htmlspecialchars($_FILES['photo']['name'])); //Writes the information to the database mysql_query("INSERT INTO band (Name,website,Description,timestamp,photo)"); VALUES ('$Name', '$website', '$Description', '$timestamp','$photo') ; //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file " . basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>
-
Okay the people that come here have been amazing. I have another issue though. I think I've learned a lot and got this almost working, but I"m getting the "500 Internal Server Error" with it. I'm trying to add an image upload directory and etc etc. I have the field added "photo" in the database at the end. Everything was working till I added the image upload. Here is what I have... *Note* I have the folder to store the image permissions set to 777 My HTML page with the form is: <html> <head> <title>Band Review Entry</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF"> <b><font face="Verdana, Arial, Helvetica, sans-serif">BAND REVIEW </font></b> <form action="connectionband.php" method="post" enctype="multipart/form-data" /> <p><font face="Verdana, Arial, Helvetica, sans-serif"><b>Name</b></font>: <br> <input type="text" name="Name" /> </p> <p><font face="Verdana, Arial, Helvetica, sans-serif"><b>Link</b></font>: <br> <input type="text" name="website" /> </p> <p><b><font face="Verdana, Arial, Helvetica, sans-serif">Description</font></b>: <br> <textarea name="Description" cols="100" rows="25"></textarea> </p> <p><font face="Verdana, Arial, Helvetica, sans-serif"><b>Photo:</b></font> <input type="hidden" name="size" value="350000"> <input type="file" name="photo"> </p> <p> <input type="submit" value="SEND IT" /> </p> </form> </body> </html> And my PHP page to get the info and send etc, is: <?php // Connects to your Database info here //This is the directory where images will be saved $target = "http://www.inthisreview.com/bandsreview/bandimages/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $Name=$_POST['Name']; $website=$_POST['website']; $Description=$_POST['Description']; $timestamp=$_POST['timestamp']; $photo = mysql_real_escape_string(htmlspecialchars($_FILES['photo']['name'])); //Writes the information to the database mysql_query("INSERT INTO band (Name,website,Description,timestamp,photo) VALUES ('$Name', '$website', '$Description', '$timestamp','$photo') ; //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>
-
Wow!!! so all I needed to do was replace the } with ." I was close then I guess haha. Thank you very much. I'm still learning this as I go.
-
Can someone please tell me what I am doing wrong with this? I'm just getting "500 Internal Server Error" without an error number or explanation or anything. echo "<tr bgcolor=\"#333333\"><td><p><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\green\"><b>{$band['Name']} - Review Posted: {date("F j, Y g:i a", strtotime($band["timestamp"]))}</b></font></tr>"; It works without the date part. But if i put the date outside the html table, it gives the date... but I'm wanting it to display next to the "Name" like.... It would echo Band Name - Reviewed Posted: January, 18th 2014 at 2:30pm Or Band Name Reviewed Posted: January, 18th 2014 at 2:30pm Many Thanks
-
Auto URL php mysql. Can someone please help me make this work?
daniel28138 replied to daniel28138's topic in Regex Help
You, my friend, have just made my day! I'm curious though, any idea why the first entry of the data base wont echo now though?