PHP - Print Script Errow Please Help Me
echo <br>"; //put a break after each database entry
} error Parse error: syntax error, unexpected '<', expecting ',' or ';' in /home/content/87/7333587/html/DepartmentC.php on line 24 SELECT `Orderdate`,`Orderid`,`Order_Comments`,`salesrep_customerid`,`productcode`,`productname`,`quantity`,`warehouselocation` FROM `Orders` WHERE `warehouselocation`=\'%j%\' how do i make this print the results Select Full Code Yes i kno connection details are missing but they work lol mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found. " . $dbuser); $mainsection="Orders"; //The name of the table where web links are stored $query1='SELECT * FROM `Orders` WHERE `warehouselocation`Like \'%j%\'' . ' ORDER BY `Orderdate`'; $result = mysql_db_query($dbname, $query1) or die("Failed Query of " . $query1); //do the query while($thisrow=mysql_fetch_row($result)) { $i=0; while ($i < mysql_num_fields($result)) { $field_name=mysql_fetch_field($result, $i); echo $thisrow[$i] . " "; //Display all the fields on one line $i++; } echo </br>"; //put a break after each database entry } Similar Tutorialshihi, so I have the following, except it goes all the way up to server 400. Is there a way to make it print after each echo? As it is right now it will not print the entire list until all 400 servers are done echo "Server 01: " . count($server01->listaccts()) . " / 130" . "<br />" ; echo "Server 02: " . count($server02->listaccts()) . " / 130" . "<br />" ; echo "Server 03: " . count($server03->listaccts()) . " / 130" . "<br />" ; echo "Server 04: " . count($server04->listaccts()) . " / 130" . "<br />" ; echo "Server 05: " . count($server05->listaccts()) . " / 130" . "<br />" ; echo "Server 06: " . count($server06->listaccts()) . " / 130" . "<br />" ; echo "Server 07: " . count($server07->listaccts()) . " / 130" . "<br />" ; echo "Server 08: " . count($server08->listaccts()) . " / 130" . "<br />" ; thanks! Hi, I have a database with numbers/dates etc stored. I am creating a multilingual site, in both English and Burmese/Myanmar. Burmese/Myanmar has a different alphabet - a bit like Chinese/Thai. The database is set up nicely to allow text translations, but I am having a problem with numbers. How would I go about printing a number/date in Burmese script from a datebase stored as numeric values - i.e.int?? Database etc. is all utf8. Thanks. Hello.
i am totally new to php and just started to learn now. i just dont understand why the following code is not printing the username that i enter on the page.
Please note that the code itself is saved with the name "basicForm.php".
Thanks.
<html> Code: [Select] $query ="SELECT oneID FROM table WHERE table.PersonID = 'game.PlayerA'" ; $result = mysql_query($query); $row = mysql_fetch_array($result); $oneID = $row[0]; [code] If I then echo "$oneID" why does it not print anything? $result echos resource7 Hello, How to customize print page in php ? I had a page, but I need to print it like an invoice look page. Thanks in advance Hi, What is the best way to print the local date and time, my website have customers from 4 or 5 countries. Saudi - UTC+3 Dubai - UTC+4 India - UTC+5.30 how to print the local time for them Thanks, I am using function to insert into database. But the primary key is automatic and I used Quote $_SESSION['Tes_ID'] = mysql_insert_id(); to retrieve this. But now that I use function method. I am not sure how to retrieve the primary key on to the next page. Code: [Select] $value = modulesql($postVar1, $postVar2, $SessionVar1, $SessionVar2); $_SESSION['Tes_ID'] = mysql_insert_id(); echo $value, $_SESSION['Tes_ID']; Code: [Select] <?php function modulesql($Tes_Name, $Tes_Description, $Use_ID, $Sub_ID){ $con = OpenConnection(); mysql_select_db("examination", $con); $module = ("INSERT INTO test (`Tes_Name`, `Tes_Description`, `Use_ID`, `Sub_ID`) VALUES ($Tes_Name, $Tes_Description, $Use_ID, $Sub_ID)") or die('Cannot Execute:'. mysql_error()); CloseConnection($con); return $module; } ?> Have I lost you with my question?? Hi I have this code to echo th econtents of a table, which contains 100 rows. I want to be able to display all 100 rows. The problem is that it displays 99 (it excludes the first). I've tried to backtrack to reconstruct the code to find out where the error is but no joy. Any ideas? Thanks in advance! Code: [Select] .... // get all entries from table $sql = "SELECT * FROM 100words ORDER BY word_id"; $result = mysqli_query($dbc, $sql); $r = mysqli_fetch_row($result); //print table entries to screen in columns echo '<div id="container">'; // results presented in html table 5 columns, 20 rows per page echo '<div id="outerbox">'; echo '<div class="innerbox">'; echo '<table class="centerresults" border="0">' . "\n"; echo '<td>'; $i = 0; $max_columns = 5; while ($list = mysqli_fetch_assoc($result)) { extract($list); // open row if counter is zero if($i == 0) echo '<tr>' . "\n"; echo '<td width="150px"><a href="word.php?w=' . $list['word'] . '">' . $list['word'] . "</a></td> \n "; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo '</td>' . "\n"; $i=0; } // END if(++$i == $max_columns) { } // END while (!empty($myArray)) { //} END while ($list = mysql_fetch_array($result)) { //END if($i < $max_columns) { echo '</tr>' . "\n"; echo '</table>' . "\n"; echo '</div>'; echo '</div>'; I have the following code but I cannot get it to print the results of the array into my web page. Help would be so appreciated!! Code: [Select] $sql = "SELECT RegName, SireID, DamID FROM pedigrees WHERE ID="; $DoggieIDQ = $sql . $values["ID"]; $DoggieIDR = db_query($DoggieIDQ,$conn); $DoggieID = $_GET['ID']; $Depth = 1; $DepthLimit=8; function getParents($DoggieID, $Depth, $DepthLimit) { $Sire = getSire($DoggieID); $Dam = getDAM($DoggieID); $Depth++; if ($Depth == $DepthLimit) { return array($Sire, $Dam); } else { # Now get grandparents too $SireParents = getParents($Sire, $Depth, $DepthLimit); $DamParents = getParents($Dam, $Depth, $DepthLimit); return array($Sire, $Dam, $SireParents, $DamParents); } } Hi, I am trying to get the form field to echo a php variable. The problem is that the form is 'Printed' via php. print "<td width=\"300\" valign=\"top\"><input type=\"text\" name=\"usr\" value=\"i.e. JBloggs \" onfocus=\"if(!this._haschanged){this.value=''};this._haschanged=true;\" tabindex=\"1\"></td>"; Instead of the value being i.e. JBloggs have it echo the $name variable. Any input would be appreciated. Is there a way to dynamically print the url of a web page once it loads? If so, how? This is for metadata purposes. Thanks! I'm working on a site where I've implemented a simple back end wysiwyg editor for content on a page. Then on the public page I run a php query to pull that content and display it. But doing this cancels out the css I have been using to split content into two columns. Is there a way to do this in php, or is there a way to circumvent the problem? ( also tried echoing the entire css style along with the query result - that didn't work either) The <p id='container_sub'> is what is split into two columns. I tried it outside of the query, and inside the query around where I echo results. Neither worked. Here's the basic php code, and further down the css that makes two columns: Code: [Select] <?php $pageid = '2'; // Formulate Query // This is the best way to perform an SQL query // For more examples, see mysql_real_escape_string() $query = sprintf("SELECT content FROM tbl_pages WHERE page_id='%s'", mysql_real_escape_string($pageid)); // Perform Query $result = mysql_query($query); // Check result // This shows the actual query sent to MySQL, and the error. Useful for debugging. if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } // Use result // Attempting to print $result won't allow access to information in the resource // One of the mysql result functions must be used // See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc. while ($row = mysql_fetch_assoc($result)) { echo "<p id='container_sub'>".$row['content']."</p>"; } // Free the resources associated with the result set // This is done automatically at the end of the script mysql_free_result($result); ?> The css.... Code: [Select] #container_sub {-moz-column-count: 2; -moz-column-gap: 25px; -webkit-column-count: 2; -webkit-column-gap: 20px; column-count: 2; column-gap: 20px;} #container_sub2 {-moz-column-count: 2; -moz-column-gap: 25px; -webkit-column-count: 2; -webkit-column-gap: 20px; column-count: 2; column-gap: 20px;} I currently have a search page on my site that prints the products but it prints the products more than once if its in more than one category I have tried getting distinct item in my SQL. But this doesnt work so im trying an if statement that if there is more than one specific result then to just print this once. I was wondering if anyone had any ideas of how to do this using an if statement I just dont know how to go about just printing the result just once if its greater than 1. The code is below to make it clearer. $searchterm = $_POST['searchterm']; trim ($searchterm); /*check if search term was entered*/ if (!$searchterm){ echo 'Please enter a search term.'; echo $searchterm; } /*add slashes to search term*/ if (!get_magic_quotes_gpc()) { $searchterm = addslashes($searchterm); } /*query the database*/ $query = "SELECT * from (products LEFT JOIN categories_products_link ON products.prod_id = categories_products_link.prod_id) LEFT JOIN categories ON categories_products_link.cat_id = categories.cat_id WHERE prod_title LIKE '%" . $searchterm . "%' ORDER BY cat_title, prod_title"; $result = mysql_query($query); /*number of rows found*/ $num_results = mysql_num_rows($result); echo '<p><h1>Search Results: '.$num_results.'</h1></p><br />'; /*loops through results*/ for ($i=0; $i <$num_results; $i++) { $num_found = $i + 1; $row = mysql_fetch_assoc($result); echo "$num_found. "?><a href="store-<?php echo $row['cat_id'];?>-<?php echo $row['prod_id']; ?>/<?php echo seo_makeSafeURI($row['prod_title']); ?>.html"><strong><?php echo $row['prod_title']; ?></strong></a> <br /> Hello.
How would I print the following:
http://site.com/break?return=site2.com
So that I can set a button containing site2.com.
Example: <a href="site2.com"></a>
And so forth:
http://site.com/break?return=site3.com
Would print: <a href="site3.com"></a>
Hello guys and gals, I am pretty green to PHP! I have an empty array that that I am trying to put images into. The thing is I have a certain file name in the folder, I want to exclude that file. This is what I have tried, any advice would be appreciated! Code: [Select] $thumbImg[] = array(); foreach (glob($DImg) as $PImg) { if (!is_file("thumbnail.jpg")) { $thumbImg[] = "<img src=\"pathtoimage\">"; } } Later on the page I am printing it out with this. It is still including the thumbnail.jpg image. Thank you in advance!! Code: [Select] for ($i=0; $i<count($thumbImg); $i++) print $thumbImg[$i]; I spent some time "Googling" today but all I found was how to create PDFs on the fly. What I wonder is if it is possible to print text on an existing PDF. And if so, could I get some pointer where to obtain this knowledge? Simply put. I have a PDF form that is not yet filled out. I would like to be able to look up an address and other information in a database, and use that information to print on the existing PDF file. Any help is much appreciated. Hi all this might be a bit of a novice question, but if anyone knows the following i would be pleased and my eyes will too I am looking for a way to print on paper or pdf (en print the pdf in the end) all the stringfunctions on php.net (http://www.php.net/manual/en/ref.strings.php) If anyone knows a way to do so i would love to hear it, because after a few days behind a computer my eyes are about to go on strike. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=346728.0 This topic has been moved to Installation in Windows. http://www.phpfreaks.com/forums/index.php?topic=351150.0 I am trying to get the code at the bottom of the script to print just once during the loop but it either doesn't print at all or repeats with the loop im am using if (!$i++) to print once and i works the first time i use it. foreach($uploadFilename as $key => $myvar) { if (!$i++) print "<!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>Upload Complete....</title> </head> <body> <body onload=\"document.forms.formname.submit);\"> <form id=\"formname\" name=\"form1\" method=\"post\" action=\"reg5.php\">\n"; echo "<input type=\"hidden\" name=\"image$key\" value=\""; echo end(explode('/',$myvar)); echo "\">\n"; if (!$i++) print "</form> </body> </html>\n"; } |