Jump to content

vet911

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by vet911

  1. I want to put a caption below the image and have it move in this responsive layout with the image. Any help would be appreciated. <style> /* For small devices (e.g. smartphones) */ img { max-width: 100%; display: inline-block; padding: 0.5%; } /* For medium devices (e.g. tablets) */ @media (min-width: 420px) { img { max-width: 100%; } } /* For large devices (e.g. desktops) */ @media (min-width: 960px) { img { max-width: 33%; } } </style> <div> <img src="images/69dyellow.png" /> <img src="images/65silver.png" /> <img src="images/64red.png" /> <img src="images/66blue.png" /> </div>
  2. I must have missed the word can't is stead can. It doesn't work with the way it's shown above. Is there anything you see to be the problem. I want to eliminate the files that aren't active. Any help would be appreciated.
  3. I am trying to control the items shown by selecting them by active = 0. I can get it to work. Any help would be appreciated. <?php try { $sql = "SELECT company.co_name, company.active, co_info.customer_no, co_info.password, co_address, co_city, co_state, co_zip, host, ftp_name, ftp_password FROM company LEFT JOIN co_info ON company.id = co_info.id WHERE company.active = '0' "; $result = $dbh->query($sql);
  4. Here is the error code: Fatal error: Call to a member function query() on a non-object in <b>/home/content/r/i/g/rigtway/html/site_1.php on line 68
  5. I have included most of the code from the beginning. <?php try { { /*** mysql hostname ***/ $hostname = 'xxxxxxxxxxxxxxxxxxxxx'; /*** mysql username ***/ $username = 'xxxxxxxxxx'; /*** mysql password ***/ $password = 'xxxxxxxxx'; $dbname = 'xxxxxx'; $dhb = null; $dbh = new PDO("mysql:host=$hostname;dbname=$dbname", $username, $password); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true ); /** echo a message saying we have connected **/ /**echo "connected"; **/ } } catch(PDOException $e) { echo $e->getMessage(); } ?> <div class="content"> <?php include('header.php');?> <?php include('menu1.php');?> <br /> <div> <center><table cellspacing="5" cellpadding="5" width="800" border="0"> <tr> <td height="57" colspan="3" width="800"> <hr /> <div style="text-align: center;">Multiuse Pictures 2014</div> <div style="text-align: center;">Click picture to enlarge.</div> <hr /> </td> </tr> <?php try { $type = $_GET['type']; //-query the database table if($_GET['type'] == 'ak') { //*$sql = "SELECT * FROM jewelry WHERE class = '$type' ";**/ $sql = "SELECT id, cid, group, image_th, image, picture, comment FROM images WHERE group = 'dionne' ORDER BY cid ASC"; } else if($_GET['type'] == 'dionne') { $sql = "SELECT * FROM images WHERE picture = '2'"; } $result = $dbh->query($sql); $rows2 = '0'; $rows3 = '0'; if($result) { $i = 0; $max_columns = 3; foreach ($result as $row) { // open row if counter is zero if($i == 0) { echo "<tr VALIGN='top'>"; } // if ($row['avail'] != "0") //{ // make sure we have a valid product ALIGN='CENTER' if($row['image_th'] != "" && $row['image_th'] != null) {
  6. I'm getting this error message after changing the $hostname given to me from Godaddy. It lists line 68 as the error: this is the code section $result = $dbh->query($sql); Any help would be appreciated. <?php try { $type = $_GET['type']; //-query the database table if($_GET['type'] == 'ak') { //*$sql = "SELECT * FROM jewelry WHERE class = '$type' ";**/ $sql = "SELECT id, cid, group, image_th, image, picture, comment FROM images WHERE group = 'dionne' ORDER BY cid ASC"; } else if($_GET['type'] == 'dionne') { $sql = "SELECT * FROM images WHERE picture = '2'"; } $result = $dbh->query($sql);
  7. Thanks for the info, that was the problem with the database, completely my error before I started.
  8. I use phpMyAdmin to view the database, it doesn't put anything in the columns except id which is generated. img_id, image, url are all zeros. Any help would be appreciated and or thoughts to correct this.
  9. Okay, I added error checking and the mysql_query and now I' getting a listing of the file names and the pictures show up. I am still not getting anything in the mysql database. No error messages are showing up. I think the problem in in the sql INSERT statement. I've listed the program below. <?php error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); require("config_0.php"); // Connect to server and select database. mysql_connect($dbhost, $dbuser, $dbpass)or die("cannot connect"); mysql_select_db("test")or die("cannot select DB"); $files = glob("image/*.jpg"); for ($i=1; $i<count($files); $i++) { $num = $files[$i]; echo "$files[$i]"; echo "<br/>"; $sql=mysql_query("INSERT INTO images (url) VALUES ('$num')"); if (!$sql) { die('Error: ' . mysql_error()); } echo '<img src="'.$num.'" alt="random image">'." "; } ?>
  10. I am having trouble trying to save my image file names to mysql after reading a dir. I am trying to use the file below. Any help would be appreciated. I was originallly getting the files to list but they we not showing up in the database. Now the page shows up blank. <?php require("config_0.php"); // Connect to server and select database. mysql_connect($dbhost, $dbuser, $dbpass)or die("cannot connect"); mysql_select_db("test")or die("cannot select DB"); $files = glob("images/*.jpg"); for ($i=1; $i<count($files); $i++) { $num = $files[$i]; $sql="INSERT INTO images (url) VALUES ('$num')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo '<img src="'.$num.'" alt="random image">'." "; } ?>
  11. Worked perfect, thanks for the help. Renamed it to picture.
  12. Okay, I have found the problem, the file names in the directory were not what I was looking for. This has been corrected thanks to your help. I now have another problem my query works fine but I want to change it to show only the files that are listed with a "1" in the column. This is what I'm trying but it doesn't work. The error message is: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'show =1' at line 1 This is my changed code. I appreciate any help provided. Thank you. $query = 'SELECT * FROM images WHERE show =1'; $stmt = $dbh->prepare($query); $stmt->execute(); $counter = 0; $numberperrow = 3; echo '<center>'; while($row = $stmt->fetch()) { if($counter < $numberperrow) { echo '<a href="'.html_escape($row['image']).'"><IMG SRC = "'.html_escape($row['image_th']).'" width="200">'; echo $row['id'] . "\t" . $row['description'] . "\n"; /**$counter = $counter + 1;**/ echo ' '; $counter = $counter + 1; }else{ echo '<br>'; $counter = '1'; echo '<a href="'.html_escape($row['image']).'"><img src="'.html_escape($row['image_th']).'" width="200">'; echo $row['id'] . "\t" . $row['description'] . "\n"; echo ' '; } }
  13. Thanks for your explanation, it definetly made a difference in the code output but the picture still doesn't show up.
  14. I can't get images to show up in my script. They show up as broken images and I can figure it out. I think it's a problem with (') or this ("). Any help would be appreciated. $query = 'SELECT * FROM images'; $stmt = $dbh->prepare($query); $stmt->execute(); $counter = 0; $numberperrow = 3; while($row = $stmt->fetch()) { if($counter < $numberperrow) { echo '<img src='.$row['image_th'].' width=200>'; /**$counter = $counter + 1;**/ echo ' '; $counter = $counter + 1; }else{ echo '<br>'; $counter = '1'; echo '<img src='.$row['image_th'].' width=200>'; echo ' '; } } } catch(PDOException $e) { echo $e->getMessage(); }
  15. I want to thank you all for the help in one way or the other you all made me think about what I was doing and I came up with this solution by using some of the comments provided. Thanks to all who posted. This is what works below. <?php if ($webpage != null) {?> <div><a href= "<?php echo $webpage; ?>" >Visit Website!</a></div> <? } ?>
  16. I'm trying to get a webpage link from my database, if there is null it just continues, but if there it's not null I want it to place the link Visit Website. I works if there isn't anything in the $webpage, but if there is something there it stops with this error message: Not Found The requested URL /< was not found on this server. Any help would be appreciated. <?php if ($webpage==null) { echo "";} else { echo "<div><a href='<?php echo $webpage; ?>'>Visit Website!</a></div>"; } ?>
  17. Thanks for the help, as it turns out I had the Dollar sign in the column for the price ($120.00) and it was preventing the calculation, I changed it to (120.00) now it works.
  18. I understand that but what I'm getting is zero not what I'm looking for. So if what your saying I should get a number 10 times my $row['price']. How can I fix this? $commission = ($row['price'] * $percent); echo $commission;
  19. I'm trying to get a percentage of a price from a table column. All I get for values are zeros. what I need is $360.00 * 10% = 36, from the code i'm trying to figure out I get zero. If i change $commission = $row['price']; to this I get the value of the row price from the database. Any help would be appreciated. Please! <?php include 'config.php'; mysql_connect($dbhost, $dbuser, $dbpass)or die("cannot connect to store database"); mysql_select_db("xxxxxx")or die("cannot select DB"); $query = "SELECT cut_stones.itemno, cut_stones.sold, cut_stones.price, commission.paid FROM cut_stones LEFT JOIN commission ON cut_stones.itemno = commission.itemno WHERE sold = '1' ORDER BY itemno"; $result = mysql_query($query) or die("There was a problem with the SQL query: " . mysql_error()); //$rows = mysql_num_rows($result); ?> <center><div><table border='1' width='300'> <tr><th align="center" width="15%">Item No.</th><th align="center" width="10%">Sold</th><th align="center" width="10%">Price</th><th align="center" width="10%">Paid</th><th align="center" width="10%">Commission</th></tr> <?php while($row = mysql_fetch_array( $result )) { $percent = 10; echo $percent; echo "<br/>"; $commission = ($row['price'] * $percent); echo $commission; ?> <tr><td width="25%"><?= $row['itemno']; ?></td><td align="center" width="10%"><?= $row['sold']; ?></td><td align="center" width="10%"><?= $row['price']; ?></td><td align="center" width="10%"><?= $row['paid']; ?></td><td align="center" width="10%"><?= $commission ?></td></tr> <?php } ?> </table></div></center> <?php mysql_close(); ?> <br> </body> </html>
  20. Changed per last suggestion, works fine now, sorry for the delay in notification.
  21. I have this horizontal menu with drop downs, I want to show the selected menu item as selected(different color) until I change pages. Here is my css code. I dont' know whic to change, any help would be appreciated. Thanks in advance. #navWrapper { background-color: #cc0000; color: inherit; border-bottom: 8px solid #cc0000; /* height*/ } #nav, #nav ul { padding: 0; margin: 0; list-style: none; font-family: verdana, arial, helvetica, sans-serif; z-index: 100; } #nav a { display: block; text-decoration: none; padding: 0.2em 0.61em 0.3em; border-right: 1px solid #ccc; font-size: 0.9em; color: #eee; background-color: inherit; } #nav li { float: left; width: 10.5em; line-height: 1.2em; margin: 0; } #nav li ul, #nav ul li { width: 14.0em; } #nav ul li a { color: #111; background-color: #ddd; border-right: 0; padding: .2em 1.5em 0.2em; } #nav li ul { position: absolute; display: none; background-color: #ddd; color: inherit; border: 1px solid #555; } #nav li:hover a, #nav a:focus, #nav a:active { color: #fff; background-color: #000; } #nav li:hover ul { display: block; } #nav li:hover ul a { color: #000000; background-color: transparent; } #nav ul a:hover { background-color: #555!important; color: #fff!important; } #nav li.navsection a { font-weight: bold; } /* \ hide from IE5 Mac */ #nav li {width: auto;}
  22. I can't check it out now, I'm at my work. I'll look tonite , would I be better using lakestmill.id_company, units_1.id_unit ?Thanks for the reply, I appreciate it!
  23. Ok originally I showed this code that produces the following:(shown below). This table name is units_1 which has multiple listings of companies and their units(individual units of a condo association). If there is more than one listed under the company name grouped to show( 4-1, 4-2, 4-3 etc). When I use left join and the group_concat (units_1.unit) as value list it produces all the correct listings except for the Quality Press Inc listing which is left blank. The code at the bottom is the code for the left join tables. I hope this helps. *********************** 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 ************************************ $query = "SELECT *, GROUP_CONCAT(unit SEPARATOR ', ') as value_list FROM units_1 GROUP BY company ASC"; $result = mysql_query($query); ************************************** $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());
×
×
  • 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.