PHP - Display Enum Filed
Hello,
I have some trouble to display result from my enum tab I did this : if ($level == "a"){ $level = "Level 1"; }else if ($level =="b"){ $level = "Level 2"; }else { $level = "Level 3"; } and on my html <?php echo $level; ?> it display Level 3 on all record... Any idea what I'm doing wrong? Similar Tutorials I have a database field `color` enum('red','blue','green','white') DEFAULT NULL, and php form <label for="color">Colors</label><br /> <input type="text" name="color" /> How do i display enum value on the php form from mysql database? Please help php mysql Hi, i don't understand how to show ENUM type data in php. Now i use: <input type="text" name="type" style="width: 362px; height: 35px;" value="<?php echo $type; ?>"> But it print only the value that is set to topic i see. How to display all ENUM values in radio buttons and that checked button would be that one from the topic. For example: ENUM ('city','town','vilage') . I select town when writing a topic. And when i edit data i see 3 radio buttons and TOWN would be checked. Thank you for answer. p.s maybe someone know a good site where is a tutorial how to show enum in php hey guys, i hope that somebody can help me! as the forum-title says, i got some problems with updating a enum-field in my db. what i have so far: i managed to filter all enum-elements from my db to a dropdown menu on my php-site. those enum-fields are 'new','awaitingcustomer','closed' what i want now: i can choose between those enum-fields in the dropdown-menu. default is 'new' i'd like now: when i select 'closed' that the db-field updates to 'closed' i hope thats clearly understandably. If not, i can certainly post my script. Greetings, Blarg this is the script for viewing the data in edit mode <tr> <td width="67" height="24"><select name="qualifi"> <option selected="selected">None</option> <?php $qry=mysql_query("select * from qualification"); while($obj=mysql_fetch_array($qry)) { ?> <option value="<?php echo $obj[0]; ?>"<?php if($obj[0]==$qualifi) echo("selected"); ?>><?php echo $obj[1]; ?></option> <?php } ?> </select> </td> <?php echo"<td width='301'><input name='board' type='text' size='50' value='$board'/></td>"; echo"<td width='60'><input name='start' type='text' size='10' value='$start'/></td>"; echo"<td width='60'><input name='end' type='text' size='10' value='$end'/></td>"; echo"<td width='60'><input name='percentage' type='text' size='10' value='$percentage'/></td> </tr>"; } ?> </table> and the update query is like //qualification if($_SESSION[empcode]!="") { if($_SESSION[qualifi]!="None") { mysql_query("update HRMEMPQUAL set EMPCODE='$_SESSION[empcode]',QUALCODE='$_SESSION[qualifi]',BOARD='$_SESSION[board]',FROMYEAR='$_SESSION[start]',TOYEAR='$_SESSION[end]',MARK_PERCENT='$_SESSION[percentage]' where EMPCODE='$_SESSION[empcode]'"); } } how can i save all the data correctly while any change is take place...their are 3 rows of data.only the last fled data is updated all the 3 rows I want to grab a list of all the school programs I have in a database (math english biology chemistry ect ect) and dispaly them in a order so that they go alphabetically downward for 12 rows and then go across so it would look like soo: Academic Advisory Class Schedules Academic Assistance Counselling Center Academic Calendars Course Descriptions and Catalogue Academics Office Department Directory Administration Departments & Programs Adult Learners Fellowships Alumnimni Chapters Finals Schedules Alumni Events Athletics Campus Life At a Glance Campus Recreation Campus Safety & Security I know to get he I am just unsure what to do in the while array to make it look how I want Code: [Select] <?php $sql = "SELECT name,id FROM table_name ORDER BY name ASC"; $res =mysql_query($sql) or die (mysql_error()); while ($row = mysql_fetch_array($res)){ //now what??? } ?> I have written a bra calculator, when the user enters their measurements their bra size is displayed however as the code I have used to do this came from a help tutorial I do not understand how it was constructed as I am quite a newb. The form works perfectly when returning data however if there is no size for a particular measurement it just displays nothing. I would like it to display N/A I have tried adding various if elses but without success. Any help is much appreciated Code: [Select] <FORM ACTION="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD=get> <input type="text" name="band" value="<?php echo $_GET['band']; ?>" /> <input type="text" name="bust" value="<?php echo $_GET['bust']; ?>" /> <INPUT TYPE=submit VALUE="Calculate"> </FORM> <?php $band = $_GET['band']; $bust = $_GET['bust']; $query = sprintf("SELECT size FROM bra_calculator WHERE band='%s' AND bust='%s'", mysql_real_escape_string($band), mysql_real_escape_string($bust)); $result = mysql_query($query); if (!$result) { echo "no"; } else { while ($row = mysql_fetch_assoc($result)) { echo $row['size']; } } mysql_free_result($result); ?> Hello. I am not entirely certain if this is even possible, but I don't see why it wouldn't. The document that I have is: Code: [Select] <?php include('../connection.php'); $query="SELECT * FROM projects"; $result=mysql_query($query); echo "<table border='1' cellpadding='10'>"; while($row = mysql_fetch_array( $result )) { echo "<tr>"; echo "<td>$row[id]</td>"; echo "<td>$row[name]</td>"; echo "<td>$row[text]</td>"; echo "<td><img src='../uploads/$row[image]'/></td>"; echo "<td><a href='editprojects.php?id=$row[id]'>Edit</a></td>"; echo "<td><a href='deleteprojects.php?id=$row[id]'>Delete</a></td>"; echo "</tr>"; } echo "</table>"; mysql_free_result($result); mysql_close($connection); ?> Basically, the only important line from that file is: Code: [Select] echo "<td><img src='../uploads/$row[image]'/></td>"; What I am doing is uploading images and other files to a PHP database. [image] = carries all the uploaded files. That single line shows every uploaded image in a row. But it doesn't show the SWF because obviously 'img src' isn't for swf's. Is it possible to add another code to THAT LINE to show the swf's? that single bit needs to be able to read images and swf's, Please help if you can. So I have this script. I connected the database and verified a working connection to the base, password correct. As I save the script on my server it saved the changes and I view the file online. The resulting page is blank. Really need help completing this code as it's essential to my sites organization, have a look below and help me if possible.
<?php Hi everyone, im not sure if this topic belongs in CSS so please move if it is but... I have a style sheet with some boxes i want my SQL results to go into, i want to know how to echo the results into the boxes. heres the html: Code: [Select] <!DOCTYPE html> <head> <title>Compaines | Removalspace.com</title> <style type="text/css"> <!-- body { background-image: url(styles/downloaded%20styles/todo/todo/images/bg.png); } --> </style> <link href="styles/downloaded styles/todo/todo/css/style.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="styles/downloaded styles/todo/todo/css/style9.css" /> <link rel="stylesheet" type="text/css" href="styles/downloaded styles/todo/todo/css/demo.css" /> <link href='http://fonts.googleapis.com/css?family=Terminal+Dosis' rel='stylesheet' type='text/css' /> <style type="text/css"> <!-- .Stile1 {color: #333333} --> </style> </head> <body> <!--start container --> <div id="container"> <header> <nav> <div id="logo"><a href="#"><img src="images/removalspace1.png" alt="Logo here" width="463" height="135" /></a> </div> <div id="search-top"> <form method="post" action="search.php"> <input type="text" onFocus="if(this.value=='Search')this.value='';" onBlur="if(this.value=='')this.value='Search';" value="Search" id="search-field"/> <input type="submit" value="" id="search-btn"/> </form> </div> <div id="nav_social"><a href="http://www.facebook.com/pages/Removalspace/181434181939226"><img src="styles/downloaded styles/todo/todo/images/facebook_32.png" alt="Become a fan" width="32" height="32" /></a><a href="#"><img src="styles/downloaded styles/todo/todo/images/twitter_32.png" alt="Follows on Twitter" /></a><a href="#"><img src="styles/downloaded styles/todo/todo/images/linkedin_32.png" alt="Linked in" /></a><a href="contact.php"><img src="styles/downloaded styles/todo/todo/images/email_32.png" alt="Contact" width="32" height="32" /></a> </div> </nav> </header> <div class="content"> <ul class="ca-menu"> <li> <a href="removals.php"> <span class="ca-icon">A</span> <div class="ca-content"> <h2 class="ca-main">Bringing removals home</h2> <h3 class="ca-sub">All in one place</h3> </div> </a> </li> <li> <a href="storage.php"> <span class="ca-icon">I</span> <div class="ca-content"> <h2 class="ca-main">Find the storage space</h2> <h3 class="ca-sub">Near You</h3> </div> </a> </li> <li> <a href="advertise_page.php"> <span class="ca-icon">C</span> <div class="ca-content"> <h2 class="ca-main">Advertise</h2> <h3 class="ca-sub">Your Business</h3> </div> </a> </li> <li> <a href="contact.php"> <span class="ca-icon">S</span> <div class="ca-content"> <h2 class="ca-main">Sophisticated Team</h2> <h3 class="ca-sub">Professionals in action</h3> </div> </a> </li> </ul> <!--star main --> <main> <div class="abox"> <figure> <fcapion> <h1>Company... </h1> </fcaption><a href="index-delete.php"></a><a href="#"><img src="images/images-8.jpeg" alt="I love graphic" width="200" height="200" /></a></figure> </div> <div class="abox"> <figure> <fcapion> <h1>Address... </h1> </fcaption> <a href="#"><img src="images/storagespace.jpg" alt="I love graphic" width="200" height="200" /></a> </figure> </div> <div class="abox"> <figure> <fcapion> <h1>Phone...</h1> </fcaption><a href="#"></a><a href="#"><img src="images/transport.jpg" alt="I love graphic" width="200" height="200" /></a></figure> </div> </main> <!--end main --> <!--start middle --> <middle> <div class="enter"> <P >Sign up to removalspace.com to advertise your business, choose from easy payment packages or add a FREE listing. Click the link to get started<br></P> <div class="imgteaser"> <a href="login-or-register.php"><img src="images/free listing2.jpg" alt="Todo el Todo" width="413" height="220" /><span class="desc"> <strong>Sign Up For Free!</strong> Start by making a FREE listing today.</span></a></div> </div> <div class="section_slogan"><img src="styles/downloaded styles/todo/todo/images/quote-right.png" alt="images" /><span class="cursive"> Nobody likes moving but finding the right people is easy at least with Removalspace.com</span><img src="styles/downloaded styles/todo/todo/images/quote-left.png" alt="images" /></div> <div class="middle_box"><h1><img src="styles/downloaded styles/todo/todo/images/fav.png" width="16" height="16" /> <a href="#">Resources</a></h1> <ol> <img src="styles/downloaded styles/todo/todo/images/dialog-ok.png" width="16" height="16" /> Search thousands of removal companies </ol> <ol> <img src="styles/downloaded styles/todo/todo/images/dialog-ok.png" width="16" height="16" /> Search for a storage facility near you </ol> <ol> <img src="styles/downloaded styles/todo/todo/images/dialog-ok.png" width="16" height="16" /> Contact Us </ol> <ol> <img src="styles/downloaded styles/todo/todo/images/dialog-ok.png" width="16" height="16" /> About removalspace. </ol> </div> <div class="middle_box"><h1><img src="styles/downloaded styles/todo/todo/images/fav.png" width="16" height="16" /> <a href="#">Blogs</a></h1> <p><img src="styles/downloaded styles/todo/todo/images/dialog-ok.png" width="16" height="16" /> Recent Post</p> <ol> <img src="styles/downloaded styles/todo/todo/images/dialog-ok.png" width="16" height="16" /> Post your comments </ol> <ol> <img src="styles/downloaded styles/todo/todo/images/dialog-ok.png" width="16" height="16" /> Read Reviews </ol> <ol> <img src="styles/downloaded styles/todo/todo/images/dialog-ok.png" width="16" height="16" /> Recent removalspace things. </ol> </div> <div class="middle_box"> <h1><img src="styles/downloaded styles/todo/todo/images/fav.png" width="16" height="16" /> <a href="#">Other </a></h1> <img src="styles/downloaded styles/todo/todo/images/dialog-ok.png" width="16" height="16" /> Advertisment Page <ol> <img src="styles/downloaded styles/todo/todo/images/dialog-ok.png" width="16" height="16" /> Affiliate Links </ol> <ol> <img src="styles/downloaded styles/todo/todo/images/dialog-ok.png" width="16" height="16" /> Our Packages. </ol></div> </middle> </div> <!--end middle --> <!--start footer --> <footer> <div id="footer"> <div id="footerleft"> <h2>removalspace</h2> <ul> <li><a href="http://www.imediacreatives.it">Contact</a></li> <li><a href="styles/downloaded styles/todo/todo/...">About Us</a></li> <li><a href="styles/downloaded styles/todo/todo/...">Other</a></li> </ul> </div> <div id="footermiddle"> <h2>User Comments</h2> <ul> <li><a href="styles/downloaded styles/todo/todo/...">Read Reviews</a></li> <li><a href="http://www.imediacreatives.it">Leave A Comment</a></li> <li><a href="styles/downloaded styles/todo/todo/...">Read Blogs</a></li> </ul> </div> <div id="footerright"> <h2>our mission</h2> <ul> <li><a href="">Who Are We?</a></li> <li><a href="">What We Do</a></li> <li><a href="">Our Mission</a></li> </ul> </div> <details> <summary> <p> Copyright © removalspace.com -2012.</p></summary><p></p> </details> </div> </footer> <!--end footer --> </div> <!--end container --> <!-- Free template distributed by http://freehtml5templates.com --> </body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> </html> heres the php code: Code: [Select] <?PHP include ('db.php'); $query = "SELECT * FROM companies ORDER BY approved DESC, company_name ASC"; $result = mysql_query($query); ?> <table border="0" cellpadding="1" cellspacing="2" bordercolor="#0066FF" background="images/table-images/back.png"> <tr> <th background="images/table-images/pattern.png">Company Name</th> <th background="images/table-images/pattern-head.png">Contact Name:</th> <th background="images/table-images/pattern.png">Contact Number:</th> <th background="images/table-images/pattern-head.png">Contact Email:</th> <th background="images/table-images/pattern.png">Address 1:</th> <th background="images/table-images/pattern-head.png">Address 2:</th> <th background="images/table-images/pattern.png">Area:</th> <th background="images/table-images/pattern-head.png">Postcode:</th> <th> - </th> <th> - </th> <th> - </th> <tr> <?php while ( $row = mysql_fetch_array($result)) { $approved = $row['approved']; SWITCH ($approved) { case 0: break; case 1: ?> <tr> <td><?PHP echo $row['company_name']; ?></td> <td><?PHP echo $row['contact_name']; ?></td> <td><?PHP echo $row['phone']; ?></td> <td><?PHP echo $row['email']; ?></td> <td><?PHP echo $row['street1']; ?></td> <td><?PHP echo $row['street2']; ?></td> <td><?PHP echo $row['location']; ?></td> <td><?PHP echo $row['postcode']; ?></td> <td></td> <td></td> <td></td> </tr> <?PHP break; case 2: ?> <tr> <td><?PHP echo $row['company_name']; ?></td> <td><?PHP echo $row['contact_name']; ?></td> <td><?PHP echo $row['phone']; ?></td> <td><?PHP echo $row['email']; ?></td> <td><?PHP echo $row['street1']; ?></td> <td><?PHP echo $row['street2']; ?></td> <td><?PHP echo $row['location']; ?></td> <td><?PHP echo $row['postcode']; ?></td> <td><?PHP echo $row['basicpackage_description']; ?></td> <td>-</td> <td>-</td> </tr> <?PHP break; case 3: ?> <tr> <td><?PHP echo $row['company_name']; ?></td> <td><?PHP echo $row['contact_name']; ?></td> <td><?PHP echo $row['phone']; ?></td> <td><?PHP echo $row['email']; ?></td> <td><?PHP echo $row['street1']; ?></td> <td><?PHP echo $row['street2']; ?></td> <td><?PHP echo $row['location']; ?></td> <td><?PHP echo $row['postcode']; ?></td> <td><?PHP echo $row['basicpackage_description']; ?></td> <td><?PHP echo $row['premiumuser_description']; ?></td> <td><img src="images/thumbs/<?PHP echo $row['upload']; ?>" alt="logo"/></td> </tr> <?PHP break; } } echo "</table>"; ?> That is currently set to echo out a table but i only want "company" "address" "phone" to make things easier. Company name = box1 street1,street2, location, postcode = box2 (for address) phone = box3 I hope theres enough information for any help, thank you in advance! Back again!! I have been trying to think of a way to do this but its starting to make my brain itch a bit too much now!!! I have the code below to display my query. Basicly its to disply 3 images and when 'x=a multiple of 3' it ends the row and starts another. The only problem is, that the first result will not be displayed as x has to begin at 1. if x begins at 0, it will display the first result and begin a new line. Code: [Select] echo "<center><table border='0' cell padding='3'><tr>"; $x = 1; while ($x < $num) { $id=mysql_result($result,$x,"id"); $caption=mysql_result($result,$x,"cap"); $address=mysql_result($result,$x,"address"); $date=mysql_result($result,$x,"date"); $album=mysql_result($result,$x,"album"); $member=mysql_result($result,$x,"member"); echo "<td><center><img src='/images/uploads/main/thumb_".$address."'><br>$caption</center></td>"; echo ($x % 3 == 0)? "</tr><tr>" : ""; $x++; } echo "</tr></table>"; Can anyone point me in the right direction?? Thanks Eric Hey there I am having a problem where I am pulling the records for images from my database and then trying to display them. What happens is there are three images in the database and I want to display them. My code displays the images but it only shows two of the three. I know there are three images in the database I put them in and checked just to make sure. It just seems to only want to display two images instead of three. Here's the code:$getImages = "SELECT * FROM Images WHERE SKU = '".$sku."'"; $resultGetImages = mysql_query($getImages); $records = mysql_fetch_assoc($resultGetImages); ?> while($records = mysql_fetch_assoc($resultGetImages)){ echo "<a onclick=\"document.getElementById('placeholder').src='../../".$records['Path']."'\" target=\"_blank\"><img src=\"../../".$records['ThumbPath']."\" alt=\"".$records['Description']."\" height=\"".$records['ThumbWidth']."\" /></a>\n"; } ?> I have tried a for loop as well but it displayed more images than were in the database and just a single image over and over again. I know that was a flaw in my code and I'm not even sure a for loop would even be a reasonable way to go. hello, newbie here. i am struggling with the way my table is displayed. as you can see if you goto http://durhamit.ca/citycore/2/tsreview.php and goto october 20th, Rui Zhang has 3 entries and im trying to make it display one at a time. here is my code if anyone can point me in the right direction. Code: [Select] <?php include 'config.php'; include 'javascript.php'; $d = date("d"); $m = date("m"); $y = date("Y"); ?> <center> <form method="POST"> Month: <select size="1" name="m"> <option selected="selected" value="<?php echo $m; ?>"><?php echo $m; ?></option> <?php $mlist = range( 1,12 ); foreach ($mlist as $v ) { echo "<option value=\"$v\">$v</option>\n"; } ?> </select> Day: <select size="1" name="d"> <option selected="selected" value="<?php echo $d; ?>"><?php echo $d; ?></option> <?php $dlist = range( 1,31 ); foreach( $dlist as $v ) { echo "<option value=\"$v\">$v</option>\n"; } ?> </select> Year: <select size="1" name="y"> <option selected="selected" value="<?php echo $y; ?>"><?php echo $y; ?></option> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> </select> <input type="submit" value="View" name="view"> </form> <?php if(isset($_POST['view'])) { $y3=$_POST['y']; $m3=$_POST['m']; $d3=$_POST['d']; $pdate=$y3."-".$m3. "-".$d3; $pdate1 = date( 'D M j', strtotime($pdate) ); } else { $pdate = date('Y-m-d', strtotime("-1 day") ); $pdate1 = date( 'D M j', strtotime($pdate) ); } $pdate2 = date('Y-m-d', strtotime("-1 day, $pdate") ); $y4 = date('Y', strtotime("$pdate2") ); $m4 = date('m', strtotime("$pdate2") ); $d4 = date('d', strtotime("$pdate2") ); $pdate3 = date('Y-m-d', strtotime("+1 day, $pdate") ); $y5 = date('Y', strtotime("$pdate3") ); $m5 = date('m', strtotime("$pdate3") ); $d5 = date('d', strtotime("$pdate3") ); echo "<table border='1' style='border-collapse: collapse' bordercolorlight='#000000' bordercolordark='#000000' width='98%' align='center'>"; echo "<tr>"; echo "<td width='100%' colspan='9' align='center'>"; ?> <table border='0' cellpadding='0' width='100%'> <tr> <td width='10%' align="center"> <form name="back" method="POST"> <input type="submit" value="<<<" name="view"> <input type="hidden" name="y" value="<?php echo "$y4"; ?>"> <input type="hidden" name="m" value="<?php echo "$m4"; ?>"> <input type="hidden" name="d" value="<?php echo "$d4"; ?>"> </form> </td> <td align="center"><b>Timesheets For <?php echo "$pdate1"; ?></b></td> <td width='10%' align="center"> <form name="forward" method="POST"> <input type="hidden" name="y" value="<?php echo "$y5"; ?>"> <input type="hidden" name="m" value="<?php echo "$m5"; ?>"> <input type="hidden" name="d" value="<?php echo "$d5"; ?>"> <input type="submit" value=">>>" name="view"> </form> </td> </tr> </table> <?php echo "</td>"; echo "</tr>"; $result5 = mysql_query("SELECT * FROM staff ORDER BY name"); while($row = mysql_fetch_array($result5)) { $eid=$row['eid']; $mname=$row['name']; $result3 = mysql_query("SELECT * FROM timesheet WHERE date = '$pdate' AND eid = '$eid'"); $talltime = 0; while($row3 = mysql_fetch_array($result3)) { $tid=$row3['id']; $tdate=$row3['date']; $tjobnumber=$row3['jobnumber']; $teid=$row3['eid']; $tdescription=$row3['description']; $tsignin=$row3['start']; $tfinish=$row3['finish']; $tlunch=$row3['lunch']; $tkms=$row3['kms']; $tschednum=$row3['schednum']; $tapproval=$row3['approval']; if("$tapproval" == "1") { $tapproval1="<font color='#00FF00'>In Progress</font>"; } if("$tapproval" == "2") { $tapproval1="<a target='_blank' href='approve.php?id=$tid'><font color='#FF0000'>Approve</font></a><br /> <a href='edittimesheet.php?id=" . $tschednum . "'>Edit</a>"; } if("$tapproval" == "3") { $tapproval1="Approved"; } $tdate1 = date( 'M j, Y', strtotime($tdate) ); $tsignin1 = date( 'g:i a', strtotime($tsignin) ); $tfinish1 = date( 'g:i a', strtotime($tfinish) ); if( empty($tfinish) ) { $tfinish2="<i>In Progress"; } else { $tfinish2="$tfinish1"; } $shortid=substr($tjobnumber, 5, -1); //remove the first 5 characters and minus the last character $result = mysql_query("SELECT * FROM jobs WHERE id = '$shortid'"); while($row = mysql_fetch_array($result)) { $jstatus=$row['status']; } $result4 = mysql_query("SELECT * FROM schedule WHERE id = '$tschednum'"); while($row4 = mysql_fetch_array($result4)) { $sid=$row4['id']; $sdate=$row4['date']; $seid=$row4['eid']; $sjobnumber=$row4['jobnumber']; $sstarttime=$row4['starttime']; $sstatus=$row4['status']; $setime=$row4['etime']; } $log_in_time_string = strtotime($tsignin); $log_out_time_string = strtotime($tfinish); $difference_in_seconds = ($log_out_time_string - $log_in_time_string); $tbilled = ($difference_in_seconds / 3600); if($tbilled < 0) { $tbilled1 = $tbilled + 24; } else { $tbilled1=$tbilled; } $tbilled2 = number_format(round($tbilled1*4)/4,2); $tbilled3 = $tbilled2 - $tlunch ; $talltime += $tbilled3; if ($talltime == '0' ) { echo "nothing"; } else { echo "<tr>"; echo "<td align='left' colspan='10'><b> " . $mname . "</b></td>"; echo "</tr>"; echo "<tr> <th align='center'>Date</th> <th align='center'>Job Number</th> <th align='center' width='30%'>Service Report</th> <th align='center'>Sign In Time</th> <th align='center'>Sign Out Time</th> <th align='center'>Lunch</th> <th align='center'>Time Billed</th> <th align='center'>Estimated</th> <th align='center'>Status</th> </tr>"; echo "<tr>"; echo "<td align='center'>" . $tdate1 . "</td>"; echo "<td align='center'>" . $tjobnumber . "</td>"; echo "<td align='center'>" . $tdescription . "</td>"; echo "<td align='center'>" . $tsignin1 . "</td>"; echo "<td align='center'>" . $tfinish2 . "</td>"; echo "<td align='center'>" . $tlunch . " hour</td>"; echo "<td align='center'>"; if ($tbilled3 > $setime ) { echo "<font color='red'><b>*** " . $tbilled3 . " hours ***</b></font>"; } else { echo "" . $tbilled3 . " hours"; } echo "</td>"; echo "<td align='center'>" . $setime . " hours</td>"; echo "<td align='center' nowrap>" . $tapproval1 . "</td>"; echo "</tr>"; } echo "<tr>"; echo "<td colspan='6' align='right'><b>Totals :</td>"; echo "<td align='center' colspan='3'>"; if ($talltime > "8" ) { echo "<font color='red'><b>*** " . $talltime . " hours ***</b></font>"; } elseif ($talltime < "0" ) { echo "<font color='red'><b>Still signed into a job</b></font>"; } else { echo "" . $talltime . " hours"; } echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td align='center' colspan='10' bgcolor='#D9FFD9'> </td>"; echo "</tr>"; } } echo "</table>"; include 'close.php'; ?> Hey there, my problem is that I am trying to pull three images from a database and then displaying them with a large image above them. I want to then be able to click the smaller ones and then they become the larger one(kind of like on amazon). I am having 2 major problems with it at this point. the first is my while statement is only pulling 2 of the three images from the database, and secondly my image replacement javascript replaces with the smaller image. With the javascript it dosen't have to be done that way or in javascript so a link or suggestions on how to do that better would be great. So here's my code: <?php include('../../php/includes/openDbConn.php'); $sku = 'c-111111'; $getImages = "SELECT * FROM Images WHERE SKU = '".$sku."'"; $resultGetImages = mysql_query($getImages); $records = mysql_fetch_assoc($resultGetImages); ?> <img src="../../<?php echo $records['Path'] ?>" id="placeholder" alt="<?php echo $record['Description']; ?>" height="<?php echo $record['Width']; ?>" /> <div id="thumbImages"> <?php while($records = mysql_fetch_assoc($resultGetImages)){ echo "<a onclick=\"document.getElementById('placeholder').src='../../".$records['ThumbPath']."'\" target=\"_blank\"><img src=\"../../".$records['ThumbPath']."\" alt=\"".$records['Description']."\" height=\"".$records['ThumbWidth']."\" /></a>\n"; } ?> and a bit on the table with the images. It stores the sku and the Path of a thumbnail, regular and large sized image. All help is much appreciated. Hey guys,
I have problem displaying some stuff from mysql.
Idea was that Order's have rows like - OrderID|CustomerID|OrderDesc
So when i run $checkIsHavingOrders = mysql_query("SELECT * FROM orders ORDER BY OrderID DESC limit 10 WHERE CustomerID = '$myID'");
it should print
OrderID|CustomerID|OrderDesc
1001|1|Skin
1021|1|Skin
1031|1|Skin
(I made up the numbers so you can get image of thing i am trying to do..)
Thanks for your time!
heres my code: Code: [Select] <?php if ($pagi_count > 1) { echo '<ul class="pagination">'; echo '<li><a href="#">«</a></li>'; $pagi_start = 1; $pagi_end = $pagi_count; for ($p = $pagi_start; $p <= $pagi_end; $p++) { $link = "$url/page/".$get_letter; if ($p > 1) $link .= "/$p"; if ($p == $pagi_num) $class = ' class="current"'; else $class = ''; echo '<li'.$class.'><a href="'.$link.'">'.$p.'</a></li>'; } echo '<li><a href="#">»</a></li>'; echo '</ul>'; } ?> now this works fine, however i want it to only show 20 page numbers, and if there are more than 20 total pages, i want the current page to be in the middle of the list (unless of course the current page is 1 or 2 then it would be more to the left of the list........ example: with 13 total pages, on page 8: << 1 2 3 4 5 6 7 ( 9 10 11 12 13 >> with 55 total pages, on page 2: << 1 (2) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 >> with 65 total pages, on page 12: << 2 3 4 5 6 7 8 9 10 11 (12) 13 14 15 16 17 18 19 20 21 >> im really stumped on the math for this....any help would be much appreciated. This may be in here already and I'm sorry for not being able to find it but.. I just want to display some information that I get from the database in a HTML table only using 2 columns. Do I just set i=1 and run a if statement to see what column I am on? like Code: [Select] $i =0 While ($row = msyql_fetch_array($result)) { if ($i==0) { // start a new row echo "<tr>"; $i = $i++; }else{ //columns echo "<td>info</td>"; $i=$i++; } if ($i < 2) { //end the row reset $i echo "</tr>"; $i =0; } } Or something like that, am I heading in right direction? Thanks Stephen i have two tables, and i want to display data from the most recent entry of the two(i.e. display just one entry). i'm joining together 2 tables so that i can get this entry.Both tables contain the date, so i'm ordering the results of the query so that the most recent comes first. My tables a TOPIC topic_id topic _name section_sub_id date POST post_id post_name section_sub_id date I'm using the following code to get the last result, but nothing is being echoed $join =mysql_query("SELECT topic.*, post.* FROM topic LEFT JOIN post ON topic.section_sub_id=post.section_sub_id WHERE post.section_sub_id = " .$row2['section_sub_id']. " ORDER BY topic.date") or die("Select Error :" . mysql_error()); $latest= mysql_fetch_row($join); echo $latest['post.date']; i'm not sure if there is something wrong with the sql, or with the php. ANy help would be great I want to display thumbnails for a picture gallery and when user clicks on image the larger image opens in a new window. I can't find a straight answer on the php.net website. Can someone help? Hi,
I have a website that is 80% done when my programmer dropped the ball. I am trying to get it all to work, but have only rudimentary knowledge on what I am doing thus far and need a bit of help, please.
I have a couple of popups links that writes a reminder to check the size of necks and arms at the top of certain pages.
One of my product groups is called Collars and Armbands
which consists of 1 x category "Collars and Armbands" whic has 2 x Subcategories which are "Collars" and "Armbands" if I click on the "Collars and Armbands" tab, it displays all the contents of both subcategories Collars and Armbands, as expected. It displays the popup links for both subcategories. I don't want the popups to appear on the "Collars and Armbands" page but only on the individual "Collars" or "Armbands" pages if I click on Collars or Armbands subcategory tabs it displays the single popup link for that category. (which is what I want it to do) The problem lies in the category and subcategory names which I can't really change without making it non-logical for the customer. this the code that makes is happen if ( substr_count($sectionname,'Collars')>0 || substr_count($productname,'Collar')>0 ) { echo '<p class="measurelink noprint">Remember to <a href="neckmeasurepop.php" class="lnkpopup sllink" title="click for popup measuring instructions" onclick="slf_popupwin();return false;">Measure Your Collar Size !</a></p>'; } My question is, is there a way to set a condition that I can use for this code that says "if the $sectionname = "Collars" but NOT "Collars and Armbands" and $productname = "Collar" then display the popup link "neckmeasurepop.php". I had considered renaming the base category to something else, but that would just make things confusing for the customers. Cheers and thanks in advance hi friends. to fetch results from the database i made a function and how i call the function on a page like $results = GetResults($someID); when i print_r the $results i get all the results, but now im confused on how do i print the rows individually? say i got Title row how will i only get the Title row from the $results VAR? |