Jump to content

vet911

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by vet911

  1. I have changed the query to add the GROUP_CONCAT as shown below. It works except for one particular company which it doesn't put the units in the field. Not sure what is going on: Any help would be greatly appreciated on that problem. I don't get any error messages. $query = "SELECT lakestmill.id_company, units_1.id_unit, lakestmill.firstname, lakestmill.lastname, lakestmill.company, lakestmill.address, lakestmill.phone, lakestmill.email, lakestmill.city, lakestmill.state, lakestmill.zip, lakestmill.website, lakestmill.webname, units_1.unit, GROUP_CONCAT(units_1.unit ORDER BY units_1.unit) as value_list FROM lakestmill LEFT JOIN units_1 ON lakestmill.company = units_1.company GROUP BY company"; $result = mysql_query($query) or die("There was a problem with the SQL query: " . mysql_error());
  2. I have 2 tables currently joined which shows the partial 1st listing above, I want the results from the joined tables to include all the units for each owner to show under the listing of one owner and not multiple listings of the owner and their units. The second query shows the owners with their units. I guess that is what I mean by combine the querys, putting the GROUP_CONCAT(unit) in the query that has the joined tables. I just can figure it out with the joined tables.
  3. I tried to post images of the results of each query but it doesn't allow me to do so. What happens is the first query (which joins 2 tables) shows all the units in a column along with corresponding company value. The second query (only uses 1 table) shows all units in 1 row with the corresponding company. I want to use the joined tables to produce the infomation shown in the second listing below. I hope this helps. 1st ******************************** Collins Precision Machine Mike Collins 3-7 CSJL John Lawrence 1-6 D.L.Raymond Dennis Raymond B-2 Dependable Lock Service William Diebert 1-2 Diagnostic Medical Systems Ron DeMayo 1-7 Duane Erickson Duane Erickson 1-13 H6 Systems, Inc. Bill Hunter 3-6 Joseph Fariz Joseph Fariz 4-2 Joseph Kaleshain Joseph Kaleshain B-9 Joseph Kaleshain Joseph Kaleshain B-11 Joseph Kaleshain Joseph Kaleshain B-14 Joseph Kaleshain Joseph Kaleshain B-16 2nd ***************************** Collins Precision Machine 3-7 CSJL 1-6 D.L.Raymond B-2 Dependable Lock Service 1-2 Diagnostic Medical Systems 1-7 Duane Erickson 1-13 H6 Systems, Inc. 3-6 Joseph Fariz 4-2 Joseph Kaleshain B-9, B-11, B-14, B-16 Joyce C & H Inc. B-5, B-4 Joyce Cooling & Heating 1-3, 1-9, 1-11 KW Management 1-5 Lighthouse Technical Sales, LLC 3-8 Mark Prolman 1-1 Quality Press Inc 4-5, 4-7 Reo Machine B-1 Robert Scott 4-6 Sempco 2-1, 2-3, 2-2, 2-5, 2-4, 2-6, 2-8 *************************************
  4. I would like to combind these 2 querys but have no clue how to do this. I'm hoping someone will help. Both work fine but the first one has more listings because the units are not grouped together. The second doesn't join the tables together. What would be the right way to make this work? $query = "SELECT lakestmill.id_company, units_1.id_unit, lakestmill.firstname, lakestmill.lastname, lakestmill.company, lakestmill.address, lakestmill.phone, lakestmill.email, lakestmill.city, lakestmill.state, lakestmill.zip, units_1.unit FROM lakestmill LEFT JOIN units_1 ON lakestmill.company = units_1.company ORDER BY company"; $result = mysql_query($query) or die("There was a problem with the SQL query: " . mysql_error()); and this one: $query = "SELECT *, GROUP_CONCAT(unit SEPARATOR ', ') as value_list FROM units_1 GROUP BY company ASC"; $result = mysql_query($query);
  5. I figured it out, it just took a while. This is what I did added GROUP BY company ASC";, now works fine for this part. On to the next part. <?php include 'config_vetmanpc.php'; $con = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db("vetmanpc") or die(mysql_error()); $query = "SELECT *, GROUP_CONCAT(unit SEPARATOR ', ') as value_list FROM units_1 GROUP BY company ASC"; $result = mysql_query($query); if($result && mysql_num_rows($result) > 0) { $i = 0; while($row=mysql_fetch_array($result)) { extract($row); if($i == 0) if($id_unit != "" && $id_unit != null) echo "$row[id_unit]"; echo "$row[company]"; echo "$row[value_list]"; echo "<br />"; } } mysql_close($con); ?>
  6. I'm having trouble with group_concat and could use some help. When i run the code as shown below, I get a return of this: ( 21Three D MachineB-10, 3-1, 1-8, 2-1, 1-3, 4-6, 1-1, B-1, 3-8, 4-2, 3-6, 1-13, 1-7, B-9, B-5, 1-5, 3-7, 1-2, B-2, 1-6, 4-5, 3-10, 3-2, 2-7, 3-4, B-17, 4-7, B-4, 2-3, 2-4, 2-2, 2-5, 2-4, 2-6, 2-8, B-11, B-14, B-16, 1-9, 1-11, B-12, B-13, 3-11, 4-1, 4-3, 4-8, 4-4) not including the brackets. When I change the code to include: WHERE id_unit = 7, i get this result (7Joyce C & H Inc.B-5, B-4, 2-4) which is only one row of the table. I'm looking for help in fixing the code to list all the id_unit that should be listed, approx 20 items. I believe what is happening is the group_concat is using all the numbers in the unit column instead of just the ones related to the id_unit number. Any help would be greatly appreciated. Thanks in advance. <?php // Make a MySQL Connection include 'config_******.php'; $con = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db("*****") or die(mysql_error()); $query = "SELECT *, GROUP_CONCAT(unit SEPARATOR ', ') as value_list FROM units_1"; /*WHERE id_unit = 7";*/ $result = mysql_query($query); if($result && mysql_num_rows($result) > 0) { $i = 0; while($row=mysql_fetch_array($result)) { extract($row); if($id_unit != "" && $id_unit != null) echo "$row[id_unit]"; echo "$row[company]"; echo "$row[value_list]"; } // end while } // end if results mysql_close($con); ?>
  7. Okay, I finally figured it out, had to remove the javascript, now works fine. Below is what i did. It turned out the javascript comments were the problem. Added a php file to do the same thing, random image showing. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>CMC/title> <meta name="Description" content="newsletter" /> <meta name="Keywords" content="newsletter, crystals, minerals, Capital, clubs" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="Copyright" content=" All Rights Reserved." /> <meta http-equiv="Content-Language" content="en" /> <meta name="revisit-after" content="15 days" /> <meta name="robots" content="index,follow" /> <meta name="Rating" content="General" /> <link href="styles/capital.css" rel="stylesheet" type="text/css" /> </head> <body> <a id="top_anchor" name="top_anchor"></a> <div id="container"><br> <div id="header"><center> <img border="2" src="image/img1.png" width="108" height="127"> <br><br> <div><h2><a>Monthly Meetings<br> Salvation Army Building<br> Clinton Street, </a><br> </div> </center> </div>
  8. My index.php has the following: <?php include('header.php'); include('menu.php'); include('intro.php'); include('notice.php'); include('footer.php'); ?> Is this not possible to do? It works perfectly in like I said Firefox, Chrome, web browsers.
  9. I'm having trouble with my header.php file in internet explorer, but it works fine in Chrome and firefox. I'm not sure what the problem is, any help would be appreciated. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>CMC/title> <meta name="Description" content="newsletter" /> <meta name="Keywords" content="newsletter, crystals, minerals, Capital, clubs" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="Copyright" content=" All Rights Reserved." /> <meta http-equiv="Content-Language" content="en" /> <meta name="revisit-after" content="15 days" /> <meta name="robots" content="index,follow" /> <meta name="Rating" content="General" /> <link href="styles/capital.css" rel="stylesheet" type="text/css" /> <script language="javascript"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin // Set up the image files to be used. var theImages = new Array() // do not change this // To add more image files, continue with the // pattern below, adding to the array. theImages[0] = 'image/smkquartz3.png' theImages[1] = 'image/aquama2t.png' theImages[2] = 'image/azurite4t.png' theImages[3] = 'image/redber2t.png' // do not edit anything below this line var j = 0 var p = theImages.length; var preBuffer = new Array() for (i = 0; i < p; i++){ preBuffer[i] = new Image() preBuffer[i].src = theImages[i] } var whichImage = Math.round(Math.random()*(p-1)); function showImage(){ document.write('<img src="'+theImages[whichImage]+'">'); } // End --> </script> </head> <body> <a id="top_anchor" name="top_anchor"></a> <div id="container"><br> <div id="header"><center> <script language="javascript"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin showImage(); </script><!-- Script Size: 1.49 KB --> <img border="2" src="image/img1.png" width="108" height="127"> <script language="javascript"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin showImage(); </script><!-- Script Size: 1.49 KB --><br><br> <div><h2><a>Monthly Meetings<br> Salvation Army Building<br> Clinton Street, </a><br> </div> </center> </div> Is there something wrong with the doctype? Thanks for any help.
  10. Thanks for trying, I am at a loss right now. Help might arrive in the future.
  11. Thanks for the help, I tried what you suggested, the code is below. The picture shows (see attachment) what has happened to the form. Not quite what I expected. pic1.png is what the change made, pic2.png is what I'm looking for. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>Capital Mineral Club.org </title> <style type="text/css"> .style1 { /* this style is for the whole table */ padding: 1em; font:80%/1 sans-serif; background-color: #f0f0f0; } /* this needs a different name but it's the same name, if it's for a lable I'd write <label for="mname" class="label-style" >Middle Name:</label> */ .label-style { float:left; width:25%; margin-right:0.5em; padding-top:0.2em; text-align:right; font-weight:bold; } /* you didn't have semicolons after the styles */ body { margin: 2em }; h4 { margin-top:2em }; input { font-size:100%; vertical-align:middle } ; </style> </head> <body> <?php $con = mysql_connect("localhost", "root", "1910") or die ('Error connecting to mysql'); mysql_select_db("cmc_members") or die(mysql_error()); $result = mysql_query("SELECT * FROM members ORDER BY lname") or die(mysql_error()); // store the record of the "members" table into $row $current = ''; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { $id = $row['id']; if (!$current) { echo "<div><table border='0' width='600' cellspacing='1' cellpadding='3' bgcolor='#f0f0f0' >"; $current = $id; } elseif ($current != $id){ echo "</table></div><br><br><div><table border='0' width='600' cellspacing='1' cellpadding='3' bgcolor='#f0f0f0' >"; $current = $id; } ?> <form class="style1"> <fieldset> <legend>Membership Information</legend> <label for="fname" class="label-style">First Name:</label> <input type="text" name="fname" id="fname" value="<?= $row['fname']; ?>"size="20" /> <br /> <label for="mname" class="label-style">Middle Name:</label> <input type="text" name="mname" id="mname" value="<?= $row['mname']; ?>"size="20" /> <br /> <label for="lname" class="label-style">Last Name:</label> <input type="text" name="lname" id="lname" value="<?= $row['lname']; ?>"size="20" /> <br /> <label for="address" class="label-style">Address:</label> <input type="text" name="address" id="address" value="<?= $row['address']; ?>"size="40" /> <br /> <label for="city" class="label-style">City:</label> <input type="text" name="city" id="city" value="<?= $row['city']; ?>"size="20" /> <br /> <label for="state" class="label-style">State:</label> <input type="text" name="state" id="state" value="<?= $row['state']; ?>"size="2" /> <br /> <label for="zip" class="label-style">Zip Code:</label> <input type="text" name="zip" id="zip" value="<?= $row['zip']; ?>"size="4" /> <br /> <label for="country">Country:</label> <input type="text" name="country" id="country" value="<?= $row['country']; ?>"size="4" /> <br /> <label for="phone">Phone:</label> <input type="text" name="phone" id="phone" value="<?= $row['phone']; ?>"size="30" /> <label for="mobile">Mobile:</label> <input type="text" name="mobile" id="mobile" value="<?= $row['mobile']; ?>"size="30" /> <br /> <label for="categories">Categories:</label> <input type="text" name="categories" id="categories" value="<?= $row['categories']; ?>"size="120" /> <br /> <label for="email">Email:</label> <input type="text" name="email" id="email" value="<?= $row['email']; ?>"size="30" /> <label for="email2">Email2:</label> <input type="text" name="email2" id="email2" value="<?= $row['email2']; ?>"size="30" /> <br /> <label for="notes">Notes:</label> <input type="text" name="notes" id="notes" value="<?= $row['notes']; ?>"size="120" /> <br /> <label for="webpage">Webpage:</label> <input type="text" name="webpage" id="webpage" value="<?= $row['webpage']; ?>"size="120" /> <br /> <label for="member">Member:</label> <input type="text" name="member" id="member" value="<?= $row['member']; ?>"size="3" /> <br /> <label for="update">Update:</label><a href="update_member.php?id=<? echo $row['id'];?>">Update</a> </fieldset> </form> <?php } echo "</table></div></center>"; ?> <?php mysql_close(); ?> <br></div> <?php include('footer.php');?> [attachment deleted by admin]
  12. Ok, plenty of interest but no help. Bummer.
  13. Did I post in the wrong forum? Okay, so the form and the css work fine before the php was added, could this possiblybe the problem? The php worked before the css was added to the form. I guessing one is the problem but can't find out which one. Any help or comments would be a ppreciated. Thanks
  14. I'm trying to use a css file to manage the tables listed when the program runs. The listings are fine but the css file doesn't load to correct the look. Any help would be appreciated. I showed the css file and the script. <style type="text/css"> form.style1 fieldset { padding: 1em; font:80%/1 sans-serif; background-color: #f0f0f0; } form.style1 label { float:left; width:25%; margin-right:0.5em; padding-top:0.2em; text-align:right; font-weight:bold; } body { margin: 2em } h4 { margin-top:2em } input { font-size:100%; vertical-align:middle } </style> <?php $con = mysql_connect("localhost", "root", "1910") or die ('Error connecting to mysql'); mysql_select_db("cmc_members") or die(mysql_error()); $result = mysql_query("SELECT * FROM members ORDER BY lname") or die(mysql_error()); // store the record of the "members" table into $row $current = ''; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title> </title> <link rel="stylesheet" type="text/css" href="form.css" /> </head> <body> <?php // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { $id = $row['id']; if (!$current) { echo "<center><div><table border='0' width='300' cellspacing='1' cellpadding='3' bgcolor='#f0f0f0' >"; $current = $id; } elseif ($current != $id){ echo "</table></div><br><br><div><table border='0' width='300' cellspacing='1' cellpadding='3' bgcolor='#f0f0f0' >"; $current = $id; } ?> <form class="style1"> <fieldset> <legend>Membership Information</legend> <label for="fname">First Name:</label> <input type="text" name="fname" id="fname" value="<?= $row['fname']; ?>"size="30" /> <br /> <label for="mname">Middle Name:</label> <input type="text" name="mname" id="mname" value="<?= $row['mname']; ?>"size="30" /> <br /> <label for="lname">Last Name:</label> <input type="text" name="lname" id="lname" value="<?= $row['lname']; ?>"size="30" /> <br /> <label for="address">Address:</label> <input type="text" name="address" id="address" value="<?= $row['address']; ?>"size="40" /> <br /> <label for="city">City:</label> <input type="text" name="city" id="city" value="<?= $row['city']; ?>"size="20" /> <br /> <label for="state">State:</label> <input type="text" name="state" id="state" value="<?= $row['state']; ?>"size="2" /> <br /> <label for="zip">Zip Code:</label> <input type="text" name="zip" id="zip" value="<?= $row['zip']; ?>"size="4" /> <br /> <label for="country">Country:</label> <input type="text" name="country" id="country" value="<?= $row['country']; ?>"size="4" /> <br /> <label for="phone">Phone:</label> <input type="text" name="phone" id="phone" value="<?= $row['phone']; ?>"size="30" /> <br /> <label for="mobile">Mobile:</label> <input type="text" name="mobile" id="mobile" value="<?= $row['mobile']; ?>"size="30" /> <br /> <label for="categories">Categories:</label> <input type="text" name="categories" id="categories" value="<?= $row['categories']; ?>"size="120" /> <br /> <label for="email">Email:</label> <input type="text" name="email" id="email" value="<?= $row['email']; ?>"size="30" /> <br /> <label for="email2">Email2:</label> <input type="text" name="email2" id="email2" value="<?= $row['email2']; ?>"size="30" /> <br /> <label for="notes">Notes:</label> <input type="text" name="notes" id="notes" value="<?= $row['notes']; ?>"size="120" /> <br /> <label for="webpage">Webpage:</label> <input type="text" name="webpage" id="webpage" value="<?= $row['webpage']; ?>"size="120" /> <br /> <label for="member">Member:</label> <input type="text" name="member" id="member" value="<?= $row['member']; ?>"size="3" /> <br /> <input class="submit" type="submit" value="Submit" /> <br /> </fieldset> </form> <?php } echo "</table></div></center>"; ?> <?php mysql_close(); ?> <br></div> <?php include('footer.php');?>
  15. Thanks for the quick response. Works like a charm.
  16. I have this code below when run gets the total number of rows for each item I require. I was wondering if there is an easier way to do this or is my way okay for what I doing? It works but I thinking there might be a faster way to do this. Any suggestions will be appreciated. I thank you in advance for your help. <?php include 'config.php'; // Connect to server and select database. mysql_connect($dbhost, $dbuser, $dbpass)or die("cannot connect"); mysql_select_db("jtovey")or die("cannot select DB"); $result0 = mysql_query("SELECT * FROM $dbname WHERE ring = '1'"); $rows0 = mysql_num_rows($result0); // results $result1 = mysql_query("SELECT * FROM $dbname WHERE earrings = '1'"); $rows1 = mysql_num_rows($result1); // results $result2 = mysql_query("SELECT * FROM $dbname WHERE pendant = '1'"); $rows2 = mysql_num_rows($result2); // results $result3 = mysql_query("SELECT * FROM $dbname WHERE cab = '1'"); $rows3 = mysql_num_rows($result3); // results $result4 = mysql_query("SELECT * FROM $dbname WHERE bead = '1'"); $rows4 = mysql_num_rows($result4); $result5 = mysql_query("SELECT * FROM $dbname WHERE new = '1'"); $rows5 = mysql_num_rows($result5); $result = mysql_query("SELECT * FROM $dbname WHERE sold = '0' ORDER BY new DESC, itemno ASC" ) or die(mysql_error()); // store the record of the "" table into $row $current = ''; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { $id = $row['id']; $new = $row['new']; if (!$current) { echo "<center><div><table border='0' width='520'>"; $current = $id; echo "<img src='images/too_jewelry.png' alt='too'/><br/>"; echo "<div>"; echo "<b>Too is a direct Gemstone & Jewelry manufacturing source for the trade.</b><br/>"; echo "</div>"; echo "<div>"; echo "Questions about store items use link in menu.<br/>"; echo "Latest (".$rows5.") "; echo "Beads (".$rows4.") "; echo "Cabochons (".$rows3.") "; echo "Earrings (".$rows1.") "; echo "Pendants (".$rows2.") "; echo "Rings (".$rows0.") "; echo "</div>"; echo "<p><b>Click picture to enlarge.</b></p>"; echo "<hr width='520'>"; } elseif ($current != $id){ echo "</table></div><br><div><table border='0' width='520'>"; $current = $id; echo "<hr width='520'>"; } ?>
  17. Worked like a charm, Thanks, I really appreciate the help.
  18. I'm having trouble with alternating row colors. My code works as far as alternating row colors, my real problem is that it gives me 4 of each row before it changes to the next row. I think my problem is in this (for($i = 0; $i < $numrows; $i++) {) but not sure how to fix it. Any help would be greatly appreciated. Thanks in advance. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="css.css" media="all"/> <? // Connects to your Database include("connect.php"); $getnews = mysql_query("select * from news ORDER BY id DESC") or die (mysql_error()); $numrows = mysql_num_rows($getnews); while($r=mysql_fetch_array($getnews)){ //get a row from our result set for($i = 0; $i < $numrows; $i++) { extract($r); echo "$i"; echo "<div class='ns' style='width: 569px';>"; if($i % 2) { //this means if there is a remainder echo "<div class='darkcell'>"; } else { echo "<div class='lightcell'>"; } echo "<div id='pad'>$date<br><a><strong>$title</strong></a><br>$news"; echo "</div>"; echo "</div>"; } } ?>
  19. Thanks for the info, I have found another way of doing this so this thread is done.
  20. I need some help with a search box, I getting this error message when I run the program: Undefined index: search in D:\xampp\htdocs\addr\vet_list11.php on line 19 If I type a year in the search box and hit search it works fine, it's just when the script is first run. Any help would be appreciated. Thanks in advance. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <title></title> <head> <link rel="stylesheet" href="./stylesheet/stylesheet1.css" media="screen"> <style type="text/css" media="screen">@import url("./stylesheet/stylesheet2.css");</style> </head> <body> <br><br><br> <center><table cellspacing="5" cellpadding="5" width="600" border="1"> <form action="" method="get"> ie: 1989, 1966, 1954 <input type="text" name="search" /> <input type="submit" value="Search"/> </form> <br><br><br> <?php include "connect.php"; $search = mysql_real_escape_string($_GET['search']); if (!isset($search) OR $search == "") { echo "Enter a search word"; } else echo "<br />"; $query = "SELECT * FROM promo_vet WHERE year LIKE '%$search%' AND photo='1' ORDER BY year ASC" or die(mysql_error()); $result = mysql_query($query) or die("There was a problem with the SQL query: " . mysql_error()); if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 3; while($row = mysql_fetch_array($result)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid product if($year != "" && $year != null) echo "<td align='center' height='350'><img src=\"$picture\" width='450'><br><FONT COLOR='red'><b>$year</b></FONT><br>$description <br>$boxno<br></td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td>$year</td>"; } ?> </tr> </table></center> </body> </html>
  21. Jcbones you hit it right on the head, I removed the <br> and now it back to the top of the page. I must have put that in yesterday cause I didn't put it there today. Thanks to all who responded.
  22. I'm having trouble with my script. I'm getting pictures from the database and showing it in 3 columns and putting some information in each table location with the picture. But I made a change and now the table still works but I get a full blank page and have to scroll down to see the pictures. Can anybody see where my problem exists, it was working fine but now it doesn't. Any help would be appreciated. Thanks in advance. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <title></title> <head> <link rel="stylesheet" href="./stylesheet/stylesheet1.css" media="screen"> <style type="text/css" media="screen">@import url("./stylesheet/stylesheet2.css");</style> </head> <body> <center><table cellspacing="5" cellpadding="5" width="800" border="1"> <?php include "connect.php"; $query = "SELECT * FROM promo_vet ORDER BY year"; $result = mysql_query($query) or die("There was a problem with the SQL query: " . mysql_error()); if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 3; while($row = mysql_fetch_array($result)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid product ALIGN='CENTER' if($year != "" && $year != null) echo "<td align='center'><a><img src=\"$picture\"></a><br>$testshot<FONT COLOR='red'><b>$year</b></FONT><br>$description <br> $boxno<br>$convertible<br>$coupe </td><BR>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table></center> </body> </html>
  23. I figured it out, thanks for you time and comments. It helped a lot.
  24. $new is coming out of the database $result currently I just searching for the new that has a 1 in it. I haven't echoed $new yet.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.