Jump to content

jefrat72

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.allsystemsgocs.com

Profile Information

  • Gender
    Not Telling

jefrat72's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I did get rid of the "Public" and it worked just fine in Firefox and Opera, IE is grumpy about it but I'll figure it out. Thanks.
  2. [quote author=wildteen88 link=topic=101236.msg400516#msg400516 date=1153410732] I'd recommend you to read the manual for using OOP with PHP4, [url=http://uk.php.net/manual/en/language.oop.php]here[/url]. [/quote] Just so I'm heading in the right direction it looks like serialize() unserialize() is to PHP4 as Public is to PHP5?  In other words that's what I need to be using to get this code to work correctly?
  3. [quote author=wildteen88 link=topic=101236.msg400516#msg400516 date=1153410732] Also if you are learning. I would strongly suggest you install Apache2.0.x, PHP5.x and MySQL4.x on your local PC/Mac/Laptop. This will allow you to develope and test your PHP scripts locally, offline, rather than using a host. [/quote] That's where I ran into the problem.  I wrote this on a PCBSD machine with Apache2.0.x, PHP5.x and MySQL5.x and transferred the code to a host using 4.3.3.  My mistake but now gotta fix it.  Thanks for the link.
  4. I'm trying to learn PHP out of a book, the machine I started on had PHP 5, the server I'm on now has PHP 4.3.3.  So when I run my code I get this error: "Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/allsys5/public_html/page.php on line 4" I [b]can not[/b] go back to PHP 5, so can anyone help me work out the error in this following code?  <?php class Page { public $content; public $title = 'Bob's Book Store'; public $keywords = 'Bob's Book Store, Three Letter Abbreviation,   some of my best friends are search engines'; public $buttons = array ( 'Home' => 'index.php',   'Books' => 'Books.php',   'Helpful Links' => 'helpfullinks.php',   'Contact Me' => 'feedback.html', ); // class Page's operations public function _set($name, $value)   {     $this->$name = $value;   } public function Display()   {     echo "<html>\n<head>\n";     $this -> DisplayTitle();     $this -> DisplayKeywords();     $this -> DisplayStyles();     echo "</head>\n<body bgcolor='white'>\n";     $this -> DisplayHeader();     $this -> DisplayMenu ($this->buttons);     echo $this->content;     $this -> DisplayFooter();     echo "</body>\n</html>\n";   } public function DisplayTitle()   {     echo "<title> ".$this->title." </title>";   } public function DisplayKeywords()   {     echo "<meta name=\"keywords\" content=\"".htmlentities($this->keywords)."\" />";   } public function DisplayStyles()   { ?> <style> <!--     h1 {color:white; font-size:34pt; text-align:center; font-family:TSCu_Comic,arial,sans-serif}     .menu {color:white; font-size:16pt; text-align:center; font-family:TSCu_Comic,arial,sans-serif; font-weight:bold}     p {color:steelblue; font-size:12pt; text-align:justify; font-family:arial,sans-serif}     p.foot {color:black; font-size:15pt; text-align:center; font-family:TSCu_Comic,arial,sans-serif; font-weight:bold}     a:link,a:visited,a:active {color:red; font-size:16pt}     a:hover {color:green} --> </style> <?php   } public function DisplayHeader()   { ?>   <table width="100%" cellpadding="1" cellspacing="0">   <TR>     <TD bgcolor="steelblue">       <h1>Bob's <br> Book Store </br></h1>     </TD>   </TR>   </table> <?php   } public function DisplayMenu($buttons)   {     echo "<table width='100%' bgcolor='steelblue' cellpadding='6' cellspacing='4'>\n";     echo "  <tr>\n";         // calculate button size     $width = 100/count($buttons);     foreach ($buttons as $name=>$url)       { $this -> DisplayButton($width, $name, $url, !$this->IsURLCurrentPage($url));       }         echo " </tr>\n";     echo "</table>\n";   } public function IsURLCurrentPage($url)   {     if(strpos($_SERVER['PHP_SELF'], $url )==false)       { return false;       }       else       { return true;       }   } public function DisplayButton($width, $name, $url, $active = true)   {     if ($active)     {       echo "<td width='".htmlentities($width)."%'>             <a href ='".htmlentities($url)."'>     <img src='reddot.gif' alt ='".htmlentities($name)."' border ='0' /></a>     <a href='".htmlentities($url)."'><span class='menu'>$name</span></a></td>";     }     else     {       echo "<td width='".htmlentities($width)."%'>     <img src='GREENDOT.GIF'>     <span class='menu'>$name</span></td>";     }   } public function DisplayFooter()   { ?>     <table width="100%" bgcolor="white" cellpadding="2" border="0">     <TR>      <p class="foot">Please call me at (123) 555-1234 <br /> or email at                          <a href="feedback.html">test@anywhere.com</a></p>     </TR>     </table> <?php   } } ?>
  5. Thanks for the help. I'm running it on a linux server FreeBSD (actually UNIX) I tried removing the "i" in mysqli and got the same errror, just about mysql instead of mysqli My php.ini looks like this: ;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; ; ; If you wish to have an extension loaded automatically, use the following ; syntax: ; ; extension=modulename.extension ; ; For example, on Windows: ; ; extension=msql.dll ; ; ... or under UNIX: ; ; extension=msql.so ; ; Note that it should be the name of the module only; no directory information ; needs to go here. Specify the location of the extension with the ; extension_dir directive above. extension=mysqli.so ; Windows Extensions ; Note that ODBC support is built in, so no dll is needed for it. ; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5) ; extension folders as well as the separate PECL DLL download (PHP 5). ; Be sure to appropriately set the extension_dir directive. ;extension=php_mbstring.dll ;extension=php_bz2.dll ;extension=php_curl.dll ;extension=php_dba.dll ;extension=php_dbase.dll ;extension=php_exif.dll ;extension=php_fdf.dll ;extension=php_filepro.dll ;extension=php_gd2.dll ;extension=php_gettext.dll ;extension=php_ifx.dll ;extension=php_imap.dll ;extension=php_interbase.dll ;extension=php_ldap.dll ;extension=php_mcrypt.dll ;extension=php_mhash.dll ;extension=php_mime_magic.dll ;extension=php_ming.dll ;extension=php_mssql.dll ;extension=php_msql.dll ;extension=php_mysql.dll ;extension=php_oci8.dll ;extension=php_openssl.dll ;extension=php_oracle.dll ;extension=php_pgsql.dll ;extension=php_shmop.dll ;extension=php_snmp.dll ;extension=php_sockets.dll ;extension=php_sqlite.dll ;extension=php_sybase_ct.dll ;extension=php_tidy.dll ;extension=php_xmlrpc.dll ;extension=php_xsl.dll
  6. [!--quoteo(post=383354:date=Jun 13 2006, 12:51 PM:name=avo)--][div class=\'quotetop\']QUOTE(avo @ Jun 13 2006, 12:51 PM) [snapback]383354[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi can we please have a look at your code thanks. [/quote] Sure, here it is <html> <head> <title>Book-O-Rama Search Results</title> </head> <body> <h1>Book-O-Rama Search Results</h1> <?php // create short variable names $searchtype=$_POST['searchtype']; $searchterm=$_POST['searchterm']; $searchterm= trim($searchterm); if (!$searchtype || !$searchterm) { echo 'You have not entered search details. Please go back and try again.'; exit; } if (!get_magic_quotes_gpc()) { $searchtype = addslashes($searchtype); $searchterm = addslashes($searchterm); } $db = new mysqli('PCBSD.localhost', 'bookorama', 'bookorama123', 'books'); if (mysqli_connect_errno()) { echo 'Error: Could not connect to database. Please try again later.'; exit; } $query = "select * from books where ".$searchtype." like '%".$searchterm."%'"; $result = $db->query($query); $num_results = $result->num_rows; echo '<p>Number of books found: '.$num_results.'</p>'; for ($i=0; $i <$num_results; $i++) { $row = $result->fetch_assoc(); echo '<p><strong>'.($i+1).'. Title: '; echo htmlspecialchars(stripslashes($row['title'])); echo '</strong><br />Author: '; echo stripslashes($row['author']); echo '<br />ISBN: '; echo stripslashes($row['isbn']); echo '<br />Price: '; echo stripslashes($row['price']); echo '</p>'; } $result->free(); $db->close(); ?> </body> </html>
  7. I'm working out of a book introducing PHP 5 and MySQL. I am doing a search that pulls from a MySQL database but I'm getting this error: Fatal error: Class 'mysqli' not found in /usr/local/www/apache22/data/PHP&MySQL/results.php on line 26 I added extension=mysqli.so to php.ini and restarted Apache, but still get the same error. Any ideas? I'm using Apache 2.2.0, MySQL 5.0.18 and PHP 5.1.2 on a PC-BSD 1.1 machine. Thanks.
  8. Thanks wildteen88, That answered the question.
  9. thanks for the reply. The prebuilt file is named "orderform.html", the script I wrote following the book is named "processorder.php" The "processorder.php" is the one displaying incorrectly. That's named correctly isn't it?
  10. Ok, did what you said (thanks), and see what you mean. But I still am getting the same output. Here's the code as it is now: <?php // create short variable names $tireqty = $_POST['tireqty']; $oilqty = $_POST['oilqty']; $sparkqty = $_POST['sparkqty']; ?> <html> <head> <title>Bob's Auto Parts - Order REsults</title> </head> <body> <h1>Bob's Auto Parts</h1> <h2>Order Results</h2> <?php echo '<p>Order processed at '; echo date('H:i, jS F'); echo '</p>'; echo '<p>Your order is as follows: </p>'; echo $tireqty.' tires<br />'; echo $oilqty.' bottles of oil<br />'; echo $sparkqty.' spark plugs<br />'; ?> </body> </html>
  11. Brand new user here, trying to learn out of a book "PHP & MySQL Web Development". It has you open their prebuilt html file (off the cd) with your browser and you then enter the number of product you purchased (in this case tires/sparkplugs&oil). when you click on the "Submit Order" button it calls this script that I've written by the books instruction: [!--coloro:#6633FF--][span style=\"color:#6633FF\"][!--/coloro--]<?php // create short variable names $tireqty = $_POST['tireqty']; $oilqty = $_POST['oilqty']; $sparkqty = $_POST['sparkqty']; ?> <html> <head> <title>Bob's Auto Parts - Order REsults</title> </head> <body> <h1>Bob's Auto Parts</h1> <h2>Order Results</h2> <?php echo '<p>Order processed at '; echo date('H:i, jS F'); echo '</p>; ?> </body> </html> echo '<p>Your order is as follow: </p>'; echo $tireqty.' tires<br />'; echo $oilqty.' bottles of oil<br />'; echo $sparkqty.' spark plugs<br />'; [!--colorc--][/span][!--/colorc--] It's supposed to say the date your order is and the amounts you ordered, like this: [!--coloro:#3366FF--][span style=\"color:#3366FF\"][!--/coloro--]Bob's Auto Parts Order Results Order processed at 4:05, 5th May Your order is as follows: 1 tires 2 bottles of oil 3 spark plugs[!--colorc--][/span][!--/colorc--] But I get this: [!--coloro:#6633FF--][span style=\"color:#6633FF\"][!--/coloro--]Bob's Auto Parts Order Results Order processed at '; echo date('H:i, jS F'); echo '; ?> echo ' Your order is as follow: '; echo $tireqty.' tires '; echo $oilqty.' bottles of oil '; echo $sparkqty.' spark plugs ';[!--colorc--][/span][!--/colorc--] Any idea why? I'm on a PCBSD machine using their PAMP package which contains Apache 2.2.0, MySQL 5.0.18 and PHP 5.1.2. I'm using Quanta Plus to write/edit the script. I've used Firefox and Opera to open this and get the same result both times. Hope this is clear enough, thanks in advance.
×
×
  • 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.