-
Posts
1,807 -
Joined
-
Last visited
Everything posted by hitman6003
-
The error you are getting, "Cannot redeclare...", means that a function with that name already exists in the location specified.
-
All you have to do is create a link of the current image...or add a "Next" link. But you still haven't answered my question...how do you determine which image should be displayed as the "next" image? Here is a one query example of your query above: <?php $photoId = $_GET['photoID']; $query = "SELECT if.image_name, if.album, if.photo, if.create_date, if.details, u.first_name, u.last_name " . "FROM image_files if " . " LEFT JOIN users u ON if.user_id = u.user_id " . "WHERE image_id = " . $photoId; $result = mysql_query($query)or die("SQL Error: $query <br>" . mysql_error()); $photo = mysql_fetch_assoc($result); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <div id="outer"> <div id="hdr"> <!--Header--> <?php include('../design/topbanner.php'); ?> </div> <div id="bar"> <!--Subheader--> <h3 style="margin-left:250px; color:#848484; padding-top:10px;"><?php echo $_SESSION['fname'].' '. $_SESSION['lname']; ?></h3> </div> <div id="bodyblock"> <!--body Lock--> <div id="l-col"> <?php include('../searchMembers.php'); ?> </div> <div id="cont"> <div class="imageFull"> <p style="font-size:10px; color:#848484; font-style:italic;"> Create Date: <?php echo $photo['create_date']; ?> </p> <p style="text-align:center"> <img src="../user_images/<?php echo $foundPhoto; ?>" /> </p> <p style="text-align:right; padding-right:20px; margin-top:5px; font-size:10px;"> From the Album:<br /> <?php echo $photo['album']; ?> <span style="color:#000000">by</span> <?php echo $photo['first_name'] . ' ' . $photo['last_name']; ?> </p> <p> <?php echo $photo['details']; ?> </p>
-
You could also use "ON DUPLICATE KEY UPDATE"... http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
-
Either do a query to check for it already being in the table, or add a unique index to your table and catch the error letting the user know that they have already been added.
-
You'll have to use Javascript, not PHP, to do what you want.
-
How do you determine which photo is the next one to display?
-
How do you determine which is the next photo?
-
$sql="SELECT * FROM linklist ORDER BY list_title ASC";
-
change $i to $j in your SQL
-
Use a code tag around your example...other wise it makes it impossible to tell what is going on with your code.
-
[SOLVED] Testing if a query returned something
hitman6003 replied to Kemik's topic in PHP Coding Help
Then reference that connection in your mysql_affected_rows call. If you're in the class, use the $this syntax, if your outside the class, and the connection is "public" you can reference it through the object... $db = new database_connection(); .... code for query .... echo mysql_affected_rows($db->connection); -
I think you mean CSV...comma seperated values http://dev.mysql.com/doc/refman/4.1/en/select.html#id3341530 which yeilds.... SELECT a,b,a+b INTO OUTFILE '/tmp/result.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM test_table;
-
[SOLVED] Testing if a query returned something
hitman6003 replied to Kemik's topic in PHP Coding Help
You want to supply the mysql link resource, not the result object from the query.... $conn = mysql_connect(.......); //$conn would be the mysql link resource $result = mysql_query(......); //$result would be the mysql result object -
You can specify the column like so: while ($list = mysql_fetch_array($result)) { echo $list['CompanyName'] . "<br />"; echo $list['anotherColumnName'] . "<br />"; } Or echo all of them like : while ($list = mysql_fetch_assoc($result)) { foreach ($list as $key => $value) { echo $key . " = " . $value; } }
-
What is a CRV file? If you want to backup your database, use mysqldump http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html Using a web based solution will be very limited in total dump size. If you want an example/solution, use phpMyAdmin.
-
for ($i = 1; $i <= 3; $i++) { $j = 1; while ($j <= 25) { mysql_query("INSERT INTO ranks SET `rank` = '" . $i . "'"); $j++; } } Or change the while loop to another for loop...works either way
-
Use a join, not a while loop...something like this... SELECT p2.user FROM profiles_viewed pv LEFT JOIN profiles p1 ON pv.userid = p1.userid LEFT JOIN profiles p2 ON pv.recipientid = p2.userid WHERE p1.user = 'some user name'
-
oops...wrong quotes... change: (productid = "" OR productid IS NULL) to (productid = '' OR productid IS NULL)
-
Might be the double quotes inside the implode function.. change it to: implode(', ', $invoices)
-
If you leave it in there the database will pull on an empty string, which would be incorrect... $query = "SELECT * FROM products WHERE cat = '" . $cat . "'" . ($subcat != "" ? " AND subcat = '" . $subcat . "' " : "") . "AND publish = 1 AND featured = 1";
-
very simple test for file field - doesn't word
hitman6003 replied to maxelct's topic in PHP Coding Help
<?php if (is_array($_FILES['upload']) && $_FILES['upload']['error'] == 0) { echo '<br />a file was selected'; } else { echo '<br />a file was not selected'; } ?> -
You can simplify greatly. Also, edit your post above and remove your connection information. $query = "SELECT invoicenum FROM invoiceid WHERE customerid = '$customerid'"; $result = mysql_query($query) or die(mysql_query()); while($row = mysql_fetch_array($result)){ $invoices[]= $row['invoicenum']; } echo "The following invoices will be updated: " . implode(", ", $invoices); $query = "UPDATE productid SET productid = " . $productid . " WHERE invoicenum IN(" . implode(", ", $invoices) . ") AND (productid = "" OR productid IS NULL)"; mysql_query($query) or die(mysql_error()); echo mysql_affected_rows() . " rows were updated by the last query<br /><br />" . $query;