pocobueno1388
Members-
Posts
3,369 -
Joined
-
Last visited
Never
Everything posted by pocobueno1388
-
[SOLVED] Placing SQL Rows into an array and picking one at random
pocobueno1388 replied to Dale_G's topic in MySQL Help
Your doing it the HARD way. <?php $result = mysql_query( "SELECT * FROM ibf_members ORDER BY RAND() LIMIT 1"); $row = mysql_fetch_assoc($result); $message = '<b>Member Name:</b> '.$row['member_name']; -
[SOLVED] Random Image Out Of The Database
pocobueno1388 replied to crapol's topic in PHP Coding Help
SELECT path, submitted_by, description FROM table_name ORDER BY RAND() LIMIT 1 -
The only reason I can see this not working is if your images are NOT in the same directory, or you are misspelling the filename. Make sure the images are in the SAME folder as the script.
-
Try Pallet_town.png
-
Okay, so it's this line we are looking at mysql_query('UPDATE count SET count = count + 1'); The first thing I notice is that you specify the tables name as "count", and also the field name as "count". Are you sure the tables name is "count"? Your syntax should be like this mysql_query('UPDATE TABLE_NAME SET count = count + 1'); Also, you have no WHERE clause. So your query is going to update EVERY records "count" field +1, is that what you want?
-
The code looks fine. Are you sure the image is in the same directory?
-
Get The Currently Executing Filename Only
pocobueno1388 replied to JustinK101's topic in PHP Coding Help
echo '<pre>',print_r($_SERVER),'</pre>'; Execute that code and look through the output for what your looking for. -
Are you calling session_start() at the top of both scripts?
-
Have you even tried Google?
-
Try this $tablename = $datecode . $producttype;
-
I put it in the code already, look for the comments (in yellow)
-
Instead of having a field named "delete" in the database, use a uniqueID field. Do you have one that holds an auto-incremented ID? If you do, thats the field you should be using. I put comments in the code <?php if (isset($_POST['delete_fields'])){ //delete all checked rows $query = "DELETE FROM table_name WHERE id IN(".implode(",", $_POST['delete']).")"; $result = mysql_query($query)or die(mysql_error()."<p>With query:<br>$query"); echo "Rows Deleted<p>"; } echo "<table border='1'> <tr> <th>Delete</th> <th>Firstname</th> <th>Lastname</th> <th>Email</th> <th>Password</th> <th>Company</th> <th>Address1</th> <th>Address2</th> <th>Address3</th> <th>County</th> <th>Country</th> <th>Post Code</th> <th>Phone Number</th> <th>Validate</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td><form class='small'>'"; //You need to change the name to be an array, and the value should be your unique field. echo "<input type='checkbox' name='delete[]' value='{$row['UNIQUE_FIELD']}' /></p></td>"; echo "<td>" . $row['NAME_FIRST'] . "</td>"; echo "<td>" . $row['NAME_LAST'] . "</td>"; echo "<td>" . $row['EMAIL'] . "</td>"; echo "<td>" . $row['PASSWORD'] . "</td>"; echo "<td>" . $row['COMPANY'] . "</td>"; echo "<td>" . $row['ADDRESS1'] . "</td>"; echo "<td>" . $row['ADDRESS2'] . "</td>"; echo "<td>" . $row['ADDRESS3'] . "</td>"; echo "<td>" . $row['COUNTY'] . "</td>"; echo "<td>" . $row['COUNTRY'] . "</td>"; echo "<td>" . $row['POST_CODE'] . "</td>"; echo "<td>" . $row['PHONE'] . "</td>"; echo "<td>" . $row['VALIDATE'] . "</td>"; echo "</tr>"; echo "<input type='submit' name='delete_fields' value='Delete' target='delete.php?'/></p>"; } echo "</table>"; ?>
-
$database = ("clintona_".$location."Inventory");
-
I need a smart select query, help on this one.
pocobueno1388 replied to csueiras's topic in MySQL Help
They are not being repeated because you are using DISTINCT. Try SELECT dt_id from ctd_data where ctd_id IN(1, 2, 4) -
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format
-
You were close, change your query to SELECT * FROM affiliations ORDER BY RAND() LIMIT 1
-
It still looks cramped. I agree with TheFilmGod, the third column is unneeded. All that information is provided in the link bar, if they want to see it, all they have to do is click. I think taking that third column out will really help.
-
Submit form that only strips out harmful code but nothing else?
pocobueno1388 replied to Jason28's topic in PHP Coding Help
This is a great class http://htmlpurifier.org/ -
You only need one query, try this <?php $usern = "SELECT user, avatar, subject, date, news FROM news ORDER BY id DESC"; $userres = mysql_query($usern) OR die(mysql_error()); while($row = mysql_fetch_array($usern)){ echo "<div id='nstaff'> <p class='avatar'>"; echo "<img src='"; echo $row['avatar']; echo "' alt='' class='tinyav' /></p>"; echo "<div id='nstaffcont'>"; echo "<p id='title'>" . $row['subject'] . '</p>'; echo "<p id='user'>By: " . $row['user'] . '<br />'; echo "Posted On: " . $row['date'] . '</p>'; echo "<p id='news'>" . $row['news'] . '</p>'; echo "</div></div>"; } ?>
-
What's the problem? I will just assume your getting an error with your query. Try this $geld2 = mysql_fetch_assoc($dbres2)or die(mysql_error() . "<p>With Query<br>$dbres2");
-
Not sure what this has to do with PHP...but I would use CSS.
-
Try this: $query = "SELECT * FROM $table WHERE '$table_id' = 69"; $q = mysql_query($query) or die (mysql_error()."<p>With Query<br>$query"); That will show you the query, and you can make sure all the variables are properly filled in as well.
-
I agree, I didn't even see that. Seems a little pointless.