PHP - Anyone Have This Problem And Solved It?
I'm having problems everything is working fine I have an Include code for php and I put a <div> code in it working with css.
It comes up on the page just fine the problem is a strange text that shows up on the page, There was other strange text that it was printing out on the page that I deleted but these two character I can't seem to find where they are in the code looked in the html file, css file and php file: }} maybe it's coming from the css file but I don't know. It shows up on the webpage and kind of is in the way of perfection on the leveling of the page. Anyone have this problem? What should I do? Should I move around the include code in the <body> I just don't know could you help me? Similar TutorialsEDIT: I solved it! I'm sure this is just a stupid mistake, but can someone please help me figure it out? I have one page with a dropdown that is populated from our database, I have submit to pull through to the next page but nothing shows up on the next page (app/approval). I've tried adding some echo statments, but they all show up blank. Code: [Select] <? require ('includes/getconfig.inc'); require ('includes/auth.inc'); require ('includes/dbfunctions.inc'); include (dirname(__FILE__).'/../includes/menuhead.inc'); include ('apptable_functions.inc'); $sql="SELECT pol_id, pol_policy_number FROM policies"; $result=myload($sql); $items = count($result); $options=""; for($x=0; $x<=$items; $x++) { $id=$result[$x]['pol_id']; $thing=$result[$x]['pol_policy_number']; $options.="<OPTION VALUE=\"$id\">".$thing; } ?> Select a case number to see the payout approval. <br> <form action="app/approval.php" method='post'> <SELECT NAME=pol_policy_number> <?=$options?> </SELECT> <input name="Submit" type="submit" Value="Submit Policy Number"/> </form> <br> Code: [Select] <? require ('includes/getconfig.inc'); require ('includes/auth.inc'); require ('includes/dbfunctions.inc'); $pol_number = $_POST['pol_policy_number']; echo "$pol_number"; ?> [Edit: Sorry I found my answer by searching for "period", then finding out that it is a string operator, then read about that. Doesn't seem easy to search for ".=" in Google. Thanks] I got some help here earlier, and I can pretty much understand everything, except I don't understand why there is Code: [Select] $recordOptions .= "<option value=\"{$row['id']}\">"; $recordOptions .= " {$row['firstname']} {$row['lastname']}, {$row['gender']}, {$row['dob']}"; $recordOptions .= "</option>\n"; Why does this whole thing break without .= ? I am new to PHP so, sorry if the answer is really obvious. Code: [Select] $recordOptions = ''; $query = "SELECT * FROM people"; $result = mysql_query($query); if(!$result) { $recordOptions = "<option>Error Retrieving Records</option>\n";; } else { while($row=mysql_fetch_assoc($result)) { $recordOptions .= "<option value=\"{$row['id']}\">"; $recordOptions .= " {$row['firstname']} {$row['lastname']}, {$row['gender']}, {$row['dob']}"; $recordOptions .= "</option>\n"; } } ?> <html> <body> <?php echo $confirmMsg; ?><br /> <form action ='' method='post'> I put a snippet up yesterday, and thought it had been solved. It had a typo error, but there is still something wrong. The whole page follows, because it might be easier to see what I am doing. The form successfully inserts a new record OK, but it will not update a record that already exists as is intended. Instead, it always creates another new record. Where can I be wrong? <?php session_start(); // See if logged in member by checking session data if (isset($_SESSION['recid'])) { // Put stored session variables into local php variable $userid = $_SESSION['recid']; $username = $_SESSION['name']; $school = $_SESSION['college']; $payer_email = $_SESSION['payer_email']; $group1 = $_SESSION['group1']; $group2 = $_SESSION['group2']; $group3 = $_SESSION['group3']; $group4 = $_SESSION['group4']; $group5 = $_SESSION['group5']; $group6 = $_SESSION['group6']; } else { ?> <!-- make login box --> <html> <tr> <td> <p> <p> <p></td> </tr> <table style= border align="center" border="1" width="400" height="200"> <td align="center" valign="center">You need to<a href="login_allocate_quiz.php">log in</a>as an administrator to<br /> allocate quizzes to student groups.</td> </table> </html> <?php exit(); } // Set error message as blank upon arrival to page $errorMsg = ""; // Check to see if the form has been submitted if (isset($_POST['equip'])){ //Connect to the database through include include_once "demo_conn.php"; //set variables $equip = $_POST['equip']; $egroup1 = $_POST['egroup1']; $egroup2 = $_POST['egroup2']; $egroup3 = $_POST['egroup3']; $egroup4 = $_POST['egroup4']; $egroup5 = $_POST['egroup5']; $egroup6 = $_POST['egroup6']; //create variables to manipulate filenames in database $lowquip = strtolower($equip); $wordquip = str_replace (" ", "", $lowquip); $bigpic = $wordquip.'big'; $smallpic = $wordquip.'small'; $bigpic = $bigpic.'.jpg'; $smallpic = $smallpic.'.jpg'; $errorMsg = '<font size="-1"><u>ERROR:</u> You have not entered the following required information.'; $nogroup = ((!$egroup1) && (!$egroup2) && (!$egroup3) && (!$egroup4) && (!$egroup5) && (!$egroup6)); $noequip = (!$equip); if ($nogroup) {$errorMsg .= "--- Student Group. (No data was forwarded to the database.)</font>";} else if($noequip) {$errorMsg .= "--- Quiz Name. (No data was forwarded to the database.)</font>";} else {$query = mysql_query("SELECT equip FROM topics WHERE equip = '$equip' AND managerId = '$userid'"); if (mysql_num_rows($query) > 0) mysql_query("UPDATE topics SET egroup1 = '$egroup1', egroup2 = '$egroup2', egroup3 = '$egroup3', egroup4 = '$egroup4', egroup5 = '$egroup5', egroup6 = '$egroup6' WHERE equip = '$equip' AND managerId = '$userid'"); else mysql_query("INSERT INTO topics (managerId, equip, title, url_big, url_small, egroup1, egroup2, egroup3, egroup4, egroup5, egroup6) VALUES ('$userid','$wordquip', '$equip', '$bigpic', '$smallpic', '$egroup1', '$egroup2', '$egroup3', '$egroup4', '$egroup5', '$egroup6')") or die (mysql_error("error 1321")); $URL='make_quiz_list_test4.php'; header ('Location: '.$URL); } } ?> <!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" dir="ltr" lang="en-US" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <meta http-equiv="X-UA-Compatible" content="IE=4"> <!-- IE5 mode --> <meta http-equiv="X-UA-Compatible" content="IE=7.5"> <!-- IE7 mode --> <meta http-equiv="X-UA-Compatible" content="IE=100"> <!-- IE8 mode --> <meta http-equiv="X-UA-Compatible" content="IE=a"> <!-- IE5 mode --> <title>Manager selected quiz list</title> <link rel="stylesheet" href="style.css" type="text/css" media="screen" /> <!--[if IE 6]><link rel="stylesheet" href="style.ie6.css" type="text/css" media="screen" /><![endif]--> <!--[if IE 7]><link rel="stylesheet" href="style.ie7.css" type="text/css" media="screen" /><![endif]--> <script type="text/javascript" src="script.js"></script> </head> <body> <div id="art-page-background-simple-gradient"> <div id="art-page-background-gradient"></div> </div> <div id="art-main"> <div class="art-sheet"> <div class="art-sheet-tl"></div> <div class="art-sheet-tr"></div> <div class="art-sheet-bl"></div> <div class="art-sheet-br"></div> <div class="art-sheet-tc"></div> <div class="art-sheet-bc"></div> <div class="art-sheet-cl"></div> <div class="art-sheet-cr"></div> <div class="art-sheet-cc"></div> <div class="art-sheet-body"> <div class="art-header"> <div class="art-header-png"></div> <div class="art-header-jpeg"></div> <div class="art-logo"> <h1 id="name-text" class="art-logo-name"><a href="#">Safety Testing Online</a></h1> <div id="slogan-text" class="art-logo-text">Safety - The Most Valuable Insurance</div> </div> </div> <div class="art-nav"> <div class="l"></div> <div class="r"></div> <div class="art-nav-center"> <ul class="art-menu"> <li> <a href="../../index.php" class="active"><span class="l"></span><span class="r"></span><span class="t">Home</span></a> </li> <li> <a href="../demo_main.php"><span class="l"></span><span class="r"></span><span class="t">Demonstrations Page</span></a> <ul> </ul> </li> <li> <a href="logout.php"><span class="l"></span><span class="r"></span><span class="t">Admin Logout</span></a> </li> </ul> </div> </div> <div class="art-content-layout"> <div class="art-content-layout-row"> <div class="art-layout-cell art-content"> <div class="art-post"> <div class="art-post-tl"></div> <div class="art-post-tr"></div> <div class="art-post-bl"></div> <div class="art-post-br"></div> <div class="art-post-tc"></div> <div class="art-post-bc"></div> <div class="art-post-cl"></div> <div class="art-post-cr"></div> <div class="art-post-cc"></div> <div class="art-post-body"></div> <div class="art-post-bl"></div> <div class="art-post-br"></div> <div class="art-post-tc"></div> <div class="art-post-bc"></div> <div class="art-post-cl"></div> <div class="art-post-cr"></div> <div class="art-post-cc"></div> <div class="art-post-body"> <div class="art-post-inner art-article"> <table style="table-layout:fixed; width:850px;"> <tr> <td style="text-align:left; width:30px;"> </td> <td style="text-align:left; width:350px;"><font size="+1">Allocation of Woodwork Quizzes to Groups.</font></td> <td style="text-align:left; text-align:center; vertical-align:bottom; width:450px;"><font color="#0000FF">Administrator: <?php echo $username; ?> - <?php echo $school; ?>.</font></td> <td style="text-align:left; width:20px;"></td> </tr> </table> <table style="table-layout:fixed; width:850px;"> <tr> <td style="text-align:left; width:30px;"></td> <td style="text-align:left; vertical-align:bottom; width:800px;"><font color="#FF0000"><?php echo "$errorMsg"; ?></font></td> <td style="text-align:left; width:20px;"></td> </tr> </table> <table style="table-layout:fixed; border:thin; text-align:left; width:850px;"> <tr> <td style="text-align:right; width:35px;"></td> <td style="text-align:left; width:190px;"></td> <td style="text-align:right; width:20px;"></td> <td style="text-align:left; width:210px;"><font color="#FF0000"></font></td> <td style="text-align:right; width:20px;"></td> <td style="text-align:left; width:110px;"></td> <td style="text-align:right; width:20px;"></td> <td style="text-align:right; width:180px;"></td> <td style="text-align:right; width:35px;"></td> </tr> <hr/> <tr> <td rowspan="12"></td> <td rowspan="12"> <br/> <form method="post" enctype="multipart/form-data" action="make_quiz_list_test4.php"> <!--<form method="post" action="< ?php echo $PHP_SELF;?>">--> <select size="25" name="equip" /> <option selected value="">No Quiz Selected</option> <option value="Biscuit Jointer">Biscuit Jointer</option> <option value="Dowelling Machine">Dowelling Machine</option> <option value="Drill Cordless">Drill - Cordless</option> <option value="Drill with Cord">Drill - Power Corded</option> <option value="Pedestal Drill">Drill - Pedestal</option> <option value="Edge Tool Sharpener">Edge Tool Sharpener</option> <option value="General Workshop Safety">General Workshop Safety</option> <option value="Pedestal Grinder">Grinder - Pedestal</option> <option value="Hand Tools">Hand Tools</option> <option value="Jointer">Jointer (fixed)</option> <option value="Jointer Surfacer Combo">Jointer/Surfacer (combo)</option> <option value="Shaper">Shaper (fixed)</option> <option value="Lathe for Wood">Lathe - Wood</option> <option value="Linisher">Linisher</option> <option value="Mortiser with Hollow Chisel">Mortiser - Hollow Chisel</option> <option value="Nailgun for Brads">Nailer - Air (brads)</option> <option value="Planer Portable">Planer - (portable)</option> <option value="Router Portable">Router - Plunge</option> <option value="Router with Sliding Table">Router Table - Slide</option> <option value="Sander Belt">Sander - Belt (fixed)</option> <option value="Sander Disc Belt Combo">Sander - Belt/Disc Combo)</option> <option value="Sander Portable Belt">Sander - Belt (portable)</option> <option value="Sander Disc">Sander - Disc (fixed)</option> <option value="Sander Orbital">Sander - Orbital</option> <option value="Sander Random Orbit">Sander - Random Orbital</option> <option value="Sander Bobbin">Sander - Vertical Spindle</option> <option value="Saw Bandsaw">Saw - Bandsaw</option> <option value="Saw Bench">Saw - Circular (bench)</option> <option value="Saw Portable Circular">Saw - Circular (portable)</option> <option value="Saw Drop or Chop">Saw - Drop (alt Chop)</option> <option value="Saw Drop and Slide">Saw - Drop & Slide</option> <option value="Jigsaw Portable">Saw - Jigsaw (portable)</option> <option value="Saw Panel">Saw - Panel (fixed)</option> <option value="Saw Radial Arm">Saw - Radial Arm</option> <option value="Saw Sabre">Saw - Sabre(portable)</option> <option value="Saw Scroll">Saw - Scroll</option> <option value="Screw Driver Portable">Screwdriver - Portable</option> <option value="Thicknesser">Thickness Planer</option> </td> <td> </td> <td> </td> <td> </td> <td rowspan="7"><br /> <br /> <br /> <input type="checkbox" name="egroup1" value="1" /> <?php echo $group1; ?> <p> <input type="checkbox" name="egroup2" value="1" /> <?php echo $group2; ?> <p> <input type="checkbox" name="egroup3" value="1" /> <?php echo $group3; ?> <p> <input type="checkbox" name="egroup4" value="1" /> <?php echo $group4; ?> <p> <input type="checkbox" name="egroup5" value="1" /> <?php echo $group5; ?> <p> <input type="checkbox" name="egroup6" value="1" /> <?php echo $group6; ?> <p> <input type="submit" value="submit" name="Send Data"> </form> </td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td style="border:solid; color:#006600; 1px; padding:10px; text-align:left;"><font size="-1">Select a Quiz Topic from the drop down list on the left. Then go to the check boxes on the right to select all of the groups that are expected to undertake this test. <p>You can select only one quiz each time, but you can select from one to six groups to undertake that quiz. <p>Repeat this process until you have allocated all of the tests that you require each group to complete. <p>If you make a mistake you can delete a quiz allocation <a href="../../under_con.php">here</a> at any time. </font></td> <td></td> <td></td> <td style="color:#006600;"><font size="-1">Go back to the <br /> <a href="member_account.php">main edit page</a>.<br/> <br /> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> </font></td> </tr> <tr> <td></td> <td> <br/> <br/> <br/> <br/></td> <td></td> <td></td> <td></td> </tr> </table> <!-- /article-content --> </div> <div class="cleared"></div> </div> <div class="cleared"></div> </div> </div> </div> </div> </div> <div class="cleared"></div> <div class="art-footer"> <div class="art-footer-inner"> <div class="art-footer-text"> <p><a href="#">Contact Us</a> | <a href="#">Terms of Use</a> | <a href="#">Trademarks</a> | <a href="#">Privacy Statement</a><br /> <?php $time = time () ; //This line gets the current time off the server $year= date("Y",$time); //This line formats it to display just the year echo "Copyright © 2010 - " . $year; //this line prints out the copyright date range, you need to edit 2010 to be your opening year ?> All Rights Reserved.</p> </div> </div> <div class="art-footer-background"></div> </div> <div class="cleared"></div> </div> </div> <div class="cleared"></div> <p class="art-page-footer">Designed by Frank.</p> </div> </body> </html> I searched the forums and the Internet as a whole looking for more information on this, but all I've turned up is a lot of information on /how/ to use create_function(), not /when/ to use it. For instance: http://en.wikipedia.org/wiki/Lambda_calculus Let me reiterate that I understand how it works in general. However, in several years of PHP programming, even through the development of fairly complex, robust systems, I can only think of one case where I recall creating a dynamic function and even here I feel like it was a design mistake. Of course, I use anonymous functions all the time in JavaScript for callback code. It seems to be used from time-to-time to iterate over and apply transformations to sets, but I don't understand the advantage over foreach() for such a task. So, if someone is so-inclined, would you mind listing a general scenario or two where create_function() is the correct and appropriate solution to the problem? SOLVED: I'm having trouble with an SQL query via php in building my Viewthread.php file So on the main page you have a list of the Threads and the link I created is like the below <h2><a href='viewthread.php?id='{$row['id']}'> {$row['Title']} </a></h2> Post {$row['id']}<br> If I set the query to an ID that exists the page loads fine $query = mysqli_query($conn, "SELECT * FROM Threads where id='156'") however if I set the id to the GET command the page doesn't load (which should've got the id) $query = mysqli_query($conn, "SELECT * FROM Threads where id=$_GET['id']") I tried casting this to a variable first too $Number = "$_GET['id']" $query = mysqli_query($conn, "SELECT * FROM Threads where id='$Number'") Edited April 2 by Fishcakes Guys thanks for helping me solve the problem i had but now i have another problem and i am lost. i have included the code below for you to have overview.
This is the code:
<table style="width:100%; margin-left:auto; margin-right:auto"> Okay, so i'm using the basic php mysql insert into function but I have a strange (or maybe not so strange, I just don't get it..) problem.. I have two columns (do you call them columns? I don't really know for sure, whatever things that are in a table whatsoever). Name and Trailer. EDIT: they are TEXT's if that matters Name is really nothing important, just the name. But I want to embed trailers.. If I embed the Megavideo code below: Code: [Select] <object width="400" height="300"><param name="movie" value="http://www.megavideo.com/v/8UZFURZQ2b55ada04d73ae65c726a5383b9ee9d9"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.megavideo.com/v/8UZFURZQ2b55ada04d73ae65c726a5383b9ee9d9" type="application/x-shockwave-flash" allowfullscreen="true" width="400" height="300"></embed></object> Everything works fine, no problems and no bullshit. But.. if I for an example try to embed this one (NovaMov): Code: [Select] <iframe style='overflow: hidden; border: 0; width: 400px; height: 300px' src='http://embed.novamov.com/embed.php?width=400&height=300&v=xngq7u8yejwbt' scrolling='no'></iframe> It doesn't work. It just doesn't insert. Is inserting an "iframe" a problem or something? I just don't get why the hell it would do this? Does anyone know anything about this? If so i'd be eager and very thankful to hear why and how to fix it. thanks in advance i'm getting this erro "Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /***/***/*****.php on line 278 not an active session, starts new" this is the code: if ($phase = mysql_result(mysql_query("SELECT `phase` FROM `as_support` WHERE `mission` = '$var2'"),0,0)) { if ($phase=='5') { // mysql_query("DELETE FROM `as_support` WHERE `mission` = '$var2'"); // header("Location: https://www.**********/*******/*******.php"); } else { echo date('h:i:s') . ": PHASE is $phase<br />"; echo "\$var1=$var1,\$var2=$var2<br />"; } } else { echo "not an active session, starts new<br />"; echo "\$var1=$var1,\$var2=$var2<br />"; mysql_query("INSERT INTO `as_support` (`mission`, `phase`) VALUES ('$var2', '0')") OR DIE(mysql_error()); the first line is line no. 278 can someone please tell me what to do? tnx shirley Hi, i use mysql_real_escape_string() function when insert in db, but when echo i use htmlentities($var, ENT_QUOTES, "UTF-8") Now problem is '\ in that text. In db it write text with single quote with \, example That\'s wrong, and when echo it show just the same like in db.. How can i fix this ? im making a website it works fine on firefox but on ie doesnt work correctly. page looks weird i see the error is <? include("index/index_files/front/php/include.php"); ?> anyone can help me its in a <html> tab. Elo, I'm creating a very simple image list that is function generated which pulls the source from a table in my database, this is my code Code: [Select] $output = "<ul>"; $img_src = get_all_image_src($sel_event['id']); while($src = mysql_fetch_array($img_src)) { for($i=0;$i <= 9; $i++) { $output .= "<li>"; $output .= "<a"; $output .= " class ='album'"; $output .= " rel='group'"; $output .= " href='/images/gallery/'" . $src['img_src'] . $i; $output .= ".jpg"; $output .= " title='sample 1'"; $output .= ">"; //Image Thumb $output .= "<img"; $output .= " src='/images/gallery/'"; $output .= $src['img_thumb_src']. $i . ".jpg"; $output .= "alt='image01' "; $output .= "title='sample title' />"; $output .= "tae"; $output .= "</a>"; $output .= "</li>"; } } $output .= "</ul>"; return $output; and the img src doesnt seems to add up... my folder structure is Sandbox>image>gallery>2011>Mall>Event>Thumbs where Sandbox is the main directory. i tried echoing the $src['img_src'] and it displays correctly the data to be added (which is 2011/Mall/Event/ plus $i and a .jpg) .. sorry noob here... any thoughts? am i missing a simple detail? Hi there, I have a map of America made in flash, where you click on a state and the page should display the SQL database information for that state in the HTML table - but instead all it shows is the first entry of the database regardless of which state you click and it doesn't display the 2 radio buttons. My code is as follows Flash Actionscript 3 (just showing one state) Code: [Select] function waClick(event:MouseEvent):void { var waURL:URLRequest = new URLRequest("restaurants.php?state=Washington"); navigateToURL(waURL, "_self"); } wa_btn.addEventListener(MouseEvent.CLICK, waClick); PHP code Code: [Select] <?php include("mvfconnect.php"); $theChoice = $_GET['state']; $query = "SELECT * FROM restaurants WHERE" .$theChoice; $result = @ mysql_query($query); if (!$result) { $message="Unfortunately we are having problems with this page, we promise to have it fixed as soon as possible"; die($message); } $num = mysql_num_fields($result); $i=0; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $show1=substr($row['state'],0,50)."..."; $show2=substr($row['city'],0,50)."..."; $show3=substr($row['rname'],0,50)."..."; $show4=substr($row['address'],0,50)."..."; $show5=substr($row['pnum'],0,50)."..."; $show6=substr($row['web'],0,50)."..."; $show7=substr($row['dishes'],0,50)."..."; $show8=substr($row['dish_details'],0,50)."..."; $show9=substr($row['challenges'],0,50)."..."; $show10=substr($row['challenge_details'],0,50)."..."; $show11=substr($row['youtube'],0,50)."..."; $show12=substr($row['images'],0,50)."..."; echo "<tr>". "<td>".$row['city']."</td>". "<td>".$row['rname']."</td>". "<td>".$row['address']."</td>". "<td>".$row['pnum']."</td>". "<td>".$row['web']."</td>". "<td>".$row['dishes']."</td>". "<td>".$row['challenges']."</td>". "<td id='state".$i."' style='display:none'>".$row['state']."</td>". "<td id='city".$i."' style='display:none'>".$row['city']."</td>". "<td id='rname".$i."' style='display:none'>".$row['rname']."</td>". "<td id='address".$i."' style='display:none'>".$row['address']."</td>". "<td id='pnum".$i."' style='display:none'>".$row['pnum']."</td>". "<td id='web".$i."' style='display:none'>".$row['web']."</td>". "<td id='dishes".$i."' style='display:none'>".$row['dishes']."</td>". "<td id='dish_details".$i."' style='display:none'>".$row['dish_details']."</td>". "<td id='challenges".$i."' style='display:none'>".$row['challenges']."</td>". "<td id='challenge_details".$i."' style='display:none'>".$row['challenge_details']."</td>". "<td id='youtube".$i."' style='display:none'>".$row['youtube']."</td>". "<td id='images".$i."' style='display:none'>".$row['images']."</td>". "<td><input type='radio' name='vid' id='vid".$i."' onclick='openVideo(".$i.")' /></td>". "<td><input type='radio' name='pic' id='pic".$i."' onclick='openImage(".$i.")' /></td>". "<td class='last'style='display:none'>".$show1." ".$show2." ".$show3." ".$show4." ".$show5." ".$show6." ".$show7." ".$show8." ".$show9." ".$show10."</td>". "</tr>"; $i++; } ?> I have used this code before and it has worked fine, can someone please help me out! Hi, im creating a script for a website that will list products, i have the basic construct which lists the products from the database but it lists then vertically, i have set the width of each 'product' to 200px so i could have around 3 colums and many rows. can anybody advise how i would make them run vertically aswell as horizontally? my code below: <?php include_once("include/globals.php"); ?> <!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=utf-8" /> <title>Untitled Document</title> <link href="styles/stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <?php //Get database Results $result = mysql_query("SELECT * FROM Products WHERE is_active = 1") or die(mysql_error()); //keeps getting the next row until no more records while($row = mysql_fetch_array($result)) { //echo results ($result) echo '<div id="holder">'; echo '<div class="title">' . $row['Name'] . '</div>'; //insert image here echo '<div class="image">'; echo '<img src="' . $row['image'] . '" width="100" alt="">'; echo '</div>'; echo '<div class="tag_line">'; echo $row['Tag_Line']; echo '</div>'; echo '<div class="price">Now Only: £'; echo $row['Website_Price']; echo '</div>'; echo '<div class="prod-footer"></div>'; echo '</div>'; } ?> </div> </body> </html> table structu Field Type Null Default Comments MIME ID int(11) No product_code varchar(255) No Name varchar(255) Yes NULL Tag_Line varchar(255) Yes NULL Description varchar(255) Yes NULL Specification varchar(255) Yes NULL Technical_Info varchar(255) Yes NULL Cost_Price_USD decimal(10,2) Yes NULL Cost_Price_GBP decimal(10,2) Yes NULL Built_in_delivery decimal(10,2) Yes NULL Trade_Price decimal(10,2) Yes NULL Trade_Plus_Price decimal(10,2) Yes NULL Website_Price decimal(10,2) Yes NULL Is_active int(1) No image varchar(255) Yes NULL Hi. I am from poland. I am 17 old age and like webmastering. I write my social network. I have new server 10 GB VPS and my script no runing In my server. in my server do can not login. No runing function Code: [Select] mb_strtolower();as delete function mb_strtolower() ; this login runing. In my server haven`t installing liberary GD and no runing upload avatars. my code upload is: elseif ($_GET['act'] == "upload") { echo <<< KONIEC <hr> <center> <p> <h2>Dodaj zdjęcie</h2> <ul class="gallery clearfix"> <li class="extra"> KONIEC; error_reporting(E_ALL); // we first include the upload class, as we will need it here to deal with the uploaded file include('include/class.upload.php'); // retrieve eventual CLI parameters $cli = (isset($argc) && $argc > 1); if ($cli) { if (isset($argv[1])) $_GET['file'] = $argv[1]; if (isset($argv[2])) $_GET['dir'] = $argv[2]; if (isset($argv[3])) $_GET['pics'] = $argv[3]; } // set variables $dir_dest = (isset($_GET['dir']) ? $_GET['dir'] : 'test'); $dir_pics = (isset($_GET['pics']) ? $_GET['pics'] : $dir_dest); if (!$cli) { } // we have three forms on the test page, so we redirect accordingly if ((isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '')) == 'simple') { // ---------- SIMPLE UPLOAD ---------- // we create an instance of the class, giving as argument the PHP object // corresponding to the file field from the form // All the uploads are accessible from the PHP object $_FILES $handle = new Upload($_FILES['my_field']); // then we check if the file has been uploaded properly // in its *temporary* location in the server (often, it is /tmp) if ($handle->uploaded) { // yes, the file is on the server // now, we start the upload 'process'. That is, to copy the uploaded file // from its temporary location to the wanted location // It could be something like $handle->Process('/home/www/my_uploads/'); $handle->Process($dir_dest); function TestProcess(&$handle, $title = 'test', $details='') { global $dir_pics, $dir_dest; $unlink = 'test/'. $handle->file_dst_name; $myid = $_SESSION['id']; $opis = htmlspecialchars(stripslashes(strip_tags(trim($_POST["opis"]))), ENT_QUOTES); $handle->Process($dir_dest); if ($handle->processed) { unlink("$unlink"); $link = ''.$dir_pics.'/' . $handle->file_dst_name .''; $addphoto = mysql_query("INSERT INTO photo VALUES('', '$myid', '$link', '$opis')"); echo <<< KONIEC <br> <center> <img src="$link" > <br> <br /> </center> KONIEC; } else { echo '<fieldset class="classuploadphp">'; echo ' <legend>' . $title . '</legend>'; echo ' Error: ' . $handle->error . ''; if ($details) echo ' <pre class="code php">' . htmlentities($details) . '</pre>'; echo '</fieldset>'; } } if (!file_exists($dir_dest)) mkdir($dir_dest); // ----------- $handle->image_convert = 'jpg'; $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_x = 500; $handle->image_precrop = 15; $handle->image_watermark = "watermark_large.png"; $handle->image_watermark_x = 20; $handle->image_watermark_y = -20; TestProcess($handle, '15px pre-cropping (before resizing 800 wide), large watermark automatically reduced, position 20 -20', "\$foo->image_convert = 'jpg';\n\$foo->image_resize = true;\n\$foo->image_ratio_y = true;\n\$foo->image_x = 800;\n\$foo->image_precrop = 15;\n\$foo->image_watermark = 'watermark_large.png';\n\$foo->image_watermark_x = 20;\n\$foo->image_watermark_y = -20;"); } else { // one error occured echo '<fieldset>'; echo ' <legend>file not uploaded to the wanted location</legend>'; echo ' Error: ' . $handle->error . ''; echo '</fieldset>'; } // we copy the file a second time // we delete the temporary files $handle-> Clean(); } else { // if we are here, the local file failed for some reasons echo '<fieldset>'; echo ' <legend>local file error</legend>'; echo ' Error: ' . $handle->error . ''; echo '</fieldset>'; } echo <<< KONIEC <li> </ul> </p> </center> KONIEC; is it the only problem that isn`t installing GD as i have something off in php.ini ? Plise Help me I do not receive email for my published php file which is: <?php ///// easend.php ///// $youremail = "acdelco40108@yahoo.com"; /*put the email address here, between quotes, the email address you want the message sent to*/ $to = $youremail; $email = $_POST['EMail']; $name2 = $_POST['Name']; $street2 = $_POST['Street']; $city2 = $_POST['City']; $state2 = $_POST['State']; $zip2 = $_POST['Zip']; $Phone = $_POST['Home_Phone']; $Cell = $_POST['Cell_Phone']; $education = $_POST['email1']; $comments = $_POST['email2'] ; $headers = "From:" . $email; $fields = array(); $fields{"Name"} = "Name"; $fields{"Street"} = "Street"; $fields{"City"} = "City"; $fields{"State"} = "State"; $fields{"Zip"} = "Zip"; $fields{"Home_Phone"} = "Home Phone"; $fields{"Cell_Phone"} = "Cell Phone"; $fields{"EMail"} = "Email"; $fields{"email1"} = "Education"; $fields{"email2"} = "Comments"; $subject = "We have received the following information from your employment application"; $body = "We have received the following information from your employment application:\n\n"; foreach($fields as $a => $b) { $body .= sprintf("%20s: %s\n",$b,$_POST[$a]); } mail ($to, $subject, $body, $headers); //send mail to owner #end create email vars $headers = "From:" . $to; mail ($email, $subject, $body, $headers); //send mail to user #end create email vars echo "<head><META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=ThankYou.html\"></head>"; ?> I have a simple text file called bio.txt: Code: [Select] wohlersr; Richie Wohlers; Intermediate; Four Aces meyersg; Greg Meyers; Novice; Four Aces I wrote a little script, to return the info for Greg Meyers if the user id is correct, or say "Member not found" if incorrect. For some reason, my output is giving me both. I assume it's a context error, but can't figure it out. Here's my script: Code: [Select] <?php $file=file("bio.txt"); $count=count($file); $i=0; while($i<=$count) { $row = explode(";", $file[$i]); $id = $row[0]; $name = $row[1]; $class = $row[2]; $club = $row[3]; if($id=="meyersg"){ echo $name."</br>"; echo $class."</br>"; echo $club."</br>"; }else{ echo "Member not found."; } $i++; } ?> And here's the output I'm getting: Code: [Select] Member not found. Greg Meyers Novice Four Aces Member not found. The problem is whit the var $threadid . It dosent work here(it dosen't display the data from database): $dbh = "SELECT *FROM comments WHERE threadid = '".$threadid."' "; But if I assign a value before the that code the html page show correctly. Code: [Select] include("config.php"); $name = $_POST['name']; $comment = $_POST['comment']; $threadid = $_POST['threadid']; if($name & $comment) { $dbh="INSERT INTO comments (name,comment,threadid) VALUES ('$name','$comment','$threadid') "; mysql_query($dbh); } $dbh = "SELECT *FROM comments WHERE threadid = '".$threadid."' "; $req = mysql_query($dbh); while($row=mysql_fetch_array($req)) { echo "<li>"; echo "<br>"."<b>".$row['name']."</b></br>"."<br>".$row['comment']."</br>"; echo "</li>"; } Code: [Select] $('.submit').click(function(){ location.reload(); var name = $("#name").val(); var comment = $("#comment").val(); var threadid = $("#v").val(); var dat = 'name='+name+'&comment='+comment+'&threadid='+threadid; $.ajax({ type:"post", url:"comment.php", data:dat, success:function(){ console.log("dat"); } }); return false; }); I am trying to use the following code snippet to return values from a database with a "," after each value apart form the last one. At the moment for testing I have 2 rows with values 1 and 3 $totalRows_Recordset3 equals 2 (I echoed this to check) $i=1; while($row_Recordset3 = mysql_fetch_assoc($Recordset3)) { if($i < $totalRows_Recordset3) { $str = $str.$row_Recordset3['reading'].","; $i=$i+1; } else { $str = $str.$row_Recordset3['reading']; $i=$i+1; } } I get the number 3 which is the last value in the database, but I can't see why I don't get "1,3" I am sure it is something simple but it just escapes me. Thanks in advance for any help Gordon Code: [Select] <?php require('config.php'); $sql = "SELECT m.Title as title , f.Reg_URL as reg FROM website_main as m JOIN website_front as f LIMIT 0,01 "; $result = @mysql_query($sql) or die(mysql_error()); echo "<table border='3'>"; echo "<font size='9'><tr> <th><FONT COLOR=red><center>Title</center></font></th> <th><FONT COLOR=red>reg</th> </tr></font>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table $reg = $row['reg']; echo "<tr><td bgcolor=''><center>"; echo $row['title']; echo "</td><td bgcolor=''><center>"; echo '.$reg.'; echo "</td></tr>"; } ?> I got a problem i try to use an attribute for $reg but only appears as .$reg. on website anyone know why? Parts i have problems with are $reg = $row['reg']; and echo '.$reg.';. thank you |