PHP - How To Code To Recall A Cell Based On A Reference Cell
I have learned php coding by doing (looking for patterns and trying things) and I have hit a roadblock trying to modify a template that creates a delimited text file of products from an ecommerce site (Sunshop) for upload to google base. I have tried to search for the answer but I don't know what I don't know so I may not have put the right search terms in. So I apologize if this has been addressed in the past.
The script uses case to call up the contents of specific rows of the product table which I understand but in when I want to call up the manufacturer row Sunshop uses a reference number and then a different table called manufacturers with an ID row that matches the manufacturer row numbers (that are associated with each product) and then next to it a name row which contains the actual manuracturer names. Can I put code in the case that will pull up the referenced name as opposed to just the numbers that are in the column? This is what I have now that just calls up the cells from the manufacurer row: Code: [Select] case 'mfg': $item[mfg] = $item[manufacturer]; The mfg refers to this part of the code in an array: Code: [Select] array('header' => 'manufacturer', 'value' => 'mfg'), In case it helps I will attach the full document. Thanks. Similar Tutorialshow to format only one specific row based on the value of one cell in a row? $result = mysql_query(select bal, etc. etc ..query ) while($row = mysql_fetch_assoc($result)) echo "<tr>"; echo "<td>" . $row['Account'] . "</td>"; echo "<td>" . $row['licence'] . "</td>"; echo "<td>" . $row['own'] . "</td>"; echo "<td>" . $row['bal'] . "</td>"; echo "</tr>"; Would appreciate help on how to format only the $row['bal'] output to red colour IF bal >5000 Thanks I have an energy monitoring system that I am building. This EMS gathers data once per minute and drops that data into a mssql db. I have php set up to interpret the values and allow the customer to query the mssql for data for a peak value within a 15 minute interval.
The user enters the 15 minute interval into the web app, along with the timeperiod (15 minute interval in question) example (2014-10-16 at 07:30:00 - 07:44:59 ). Sometimes there is no data in that interval because there was nothing reported (due to power outages or internet connection issue). When there is no data to report, there is not even an entry row set in mssql, therefore the time and date it is querying is not present.
I am trying to find a way that if php queries mssql and the row that is queried does not exist, have php look forward than backwards simultaneously until it finds any value (it can even be a zero as long as its a value) to report. I would think I could cover any situation including a major power outage by looking forward three (3) days and back three (3) days. I'm not sure where to even start with something like this. Does anyone have a suggestion on how to start?
Edited by Butterbean, 11 January 2015 - 10:05 AM. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=355480.0 I am having a problem trying to show if cell is empty echo one thing if empty and starttime if there is one: Code: [Select] if(isset($rown['starttime'])) { echo "Add Day"; } else { echo $rown['starttime']; } Hi I am using the Quote fpdf library to generate a PDF. What I'm looking to do, is to possibly 'nest' cells inside another cell. Code: [Select] ============================ | Main Cell | | ============= =========== | | Cell 2 | | Cell 3 | | ============= =========== | | ============================ So you can see I have one, main cell, and inside this I have Cell 2 and Cell 3, which I'd like inside/nested the main cell. Is this possible using the fpdf library? Thanks is there a way to make the column width to try not have multiple lines if possible when pulling 200 rows from a database? Trying to run this function so it displays the generated image in a table cell - Code: [Select] <?php function imgsecuregen($size = 6){ $width = 11*$size; $height = 25; $string = ""; for($i = 1; $i <= $size; $i++){ $string .= rand (0,9).""; } // for $im = ImageCreate($width, $height); $bg = imagecolorallocate($im, 102, 102, 102); // background $black = imagecolorallocate($im, 0, 255, 0); // text $grey = imagecolorallocate($im, 102, 102, 102); // border imagerectangle($im,0, 0, $width-1, $height-1, $grey); imagestring($im, 5, $size, 5, $string, $black); imagepng($im); imagedestroy($im); } imgsecuregen(8); // string length ?> Works if I load it directly, but not in a <td>. This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=307147.0 Hi, I have setup a little post function where you can edit it. When the data has been submitted it sends all data to a database.
When I go to edit a post this is how I have each dropdown to load the correct option:
<select name="ad_type"> <option selected="selected"><?php echo $post['ad_type']; ?></option> <option>-- Please Select --</option> <option value="For Adoption">For Adoption</option> <option value="For Sale">For Sale</option> </select>How would I do it so it would automatically select the correct option rather than having it add another option at the top? Thanks I am trying to insert data from a mysql in a table. I want the data to appear with the image on the left, item name on the top right followed by description underneath. <?php $sql = 'SELECT * FROM tbl_products ORDER BY id'; $result = $db->query($sql); $output[] = '<ul>'; $output[] = '<table border="3" bordercolor="#000000">'; while ($row = $result->fetch()) { $output[] = '<tr>'; $output[] = '<td><img src="images/'.$row['pic'].'" width="67" height="100" /></td>'; $output[] = '<td class="style10"><strong>'.$row['item_name'].'</strong></td>'; $output[] = '<td>'.$row['item_description'].'</td>'; $output[] = '</tr>'; } $output[] = '</table>'; echo join('',$output); ?> I would like the items to appear the same way as this page http://aafcollection.info/items/list.php I'm using FPDF to generate dynamic reports. How can I make sure MySQL queried results don't overflow into adjacent cells if the text length is longer then the cells designated width? I once accomplished this by using CSS with white-space:nowrap and overflow:hidden. But I can't think of how to do this with FPDF. Any ideas?? Hi guys i have another question about my shopping cart.
I have in my sql database table called products. It consist of 4 columns (product_id, description, quantity, price).
Now on my index page, I want to call just one product from cell, which would have special price. But i don't know how to call one single product.
So my code looks like that:
<?php $sql="SELECT product_id FROM Products"; $query=mysql_query($sql); $row=mysql_fetch_array($query); ?><table > <tr><img src="Images/Image.jpg" width="380" height="300" /> </tr> <tr> <td><a href="index.php?page=index&action=add&id=<?php echo $row['product_id']?>">Add to cart</a></td> </tr> <?php ?> </table>This code display me first product but i would like to call 3 product how would i do that, so i have 6 products and i would like to call product N.3 to my index page. My code calls the first one, how would it call the third. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=314271.0 Image name will come from database. It can be displayed in divs or table cells. Which is better using divs or table cells? Can anyone post sample code? http://img28.imageshack.us/i/44233003.png/ Im trying to add some info to an existing cell in a mysql database. The cell currently reads: This is a piece of information. I would like to update the cell to read: This is a piece of information. a great piece of info. I have a variable with the following; $info = a great piece of info. Is it possible to add $info to the existing cell via php eg. <?php mysql_query("UPDATE mytable SET info = '$info' WHERE row = '$row'"); ?> all fine except I dont want to SET the info to $info I simply want to add $info onto the end of the existing data in the info record. Is this possible and how do i change the above query and go about it? Many thanks Hi I have a table that populated by a recordset, and wondered whether is was possible to make a row background colour = red where a particular cell = some text? I have been searching around and not managed to find anything of use. Any help would be appreciated. Hello. Trying to get rid a line feed which is coming from a excel cell which has Text and a line feed after that word. After the excel file has been saved-as tab-delimited, that text transforms to this: "Text" That line feed is between t and the last double-quote. Hex viewer shows: 22 54 65 78 74 0A 22 so it must be that 0A. I have tried with trim() and with str_replace("\x0A","",$data) but nothing (like \r or \n) works. How do I get rid of that hidden character? Is that \x0A correct? Hello, I want to export data from php-mysql to excel in a particular cell. 1. Get the data from php-Mysql and export data to excel sheet. I already create a template excel sheet format.I want to export data from mysql to a particular cell. Sorry I can't able to attach my template excel sheet. 2. Is it possible to export image? Thanks in advance |