wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
You may/will need to also add the following line too at the beginning of your script: ini_set('display_errors', 'On');
-
If you don't want to use double quotes then you will have to format the string. eg: $str = 'A new line A tab'; echo '<pre>' . $str . '</pre>'; Why do you not want to use double quotes?
-
You are not using the session variables correctly, for example in your code above I notice you do this: <?php session_start(); $_SESSION['BusinessName']; ?> All the code does is start the session, you only need to use session_start(); once when you want to use sessions. In your code you use it more than once. But having $_SESSION['BusinessName']; on its own directly after session_start(); does nothing. When you want to use the 'BuisnessName' session variable you use $_SESSION['BusinessName'] variable, not $BusinessName or $_SESSION['$BusinessName'] variables as I have seen you use a few times in your code. So if you make a few corrections here an there you code should work how you want it.
-
I get it too. However it only happens to me if I scroll down while the page is still loading. I just quickly switch back and forth between tabs and that sorts it for me.
-
Its because PHP is a a server-side programming language. It is not a client-side language. Web browsers (such as IE, FireFox, Opera etc) can only understand client-side languages. Examples of client-side languages are HTML, CSS and Javascript etc. Whether you have PHP installed on its own on your computer the browser still doesn't know what the hell it is. However it will think its XML. XML is another type of client-side language. It will only think this due to PHP's tags being very similar to XML's tags. As they both start with the same two characters (<?) and end with the same two characters (?>), eg PHP's tags: <?php and ?> XML's tags: <?xml ?> The easiest and fatsted way of getting PHP setup with Apache is to use the WAMP package from wampserver.com. When you have it installed you must save your .php files and any other files that you link to within that .php in C:/wamp/www - not in your My Documents folder or any other place. It must in WAMP's www folder. Then you open your web browser and go to http://localhost/ OR http://127.0.0.1/ - before going to that address make sure WAMP is running. By having at the taskbar and looking for the WAMP taskbar icon - see the image at the bottom of this page to see what it looks like.
-
You have an empty else on line 41: 40. $subject = "Invoice - " . $invoice['invoicenumber'] . " - " . $invoice['studentlast'] . " - " . $invoice['coursecode'] . " - " . $invoice['coursename'] . ""; 41. else 42. { 43. $send_to = $_POST['send_to'];
-
Chnage this: query = "SELECT * FROM $table WHERE id='$id'LIMIT 1"; //$query = "SELECT * FROM $table WHERE id='$id' LIMIT 1"; $result = mysql_query($query) or die("problem with query: ".$query); $row = mysql_fetch_array($result); if ($row){ // echo "<td><td><tr>$myrow[id]</tr><tr>$myrow[Address]</tr><tr>$myrow[City]</tr><tr>$myrow[Fax]</tr><tr>$myrow[specialization]</tr><tr>$myrow[TargetSalary]</tr><tr>$myrow[JobType]</tr><tr>$myrow[WillingToRelocate]</tr></td></td>" ; } else { echo "mysql Error: " . mysql_error(); } to this: $query = "SELECT * FROM $table WHERE id='$id'LIMIT 1"; //$query = "SELECT * FROM $table WHERE id='$id' LIMIT 1"; $result = mysql_query($query) or die('problem with query: ' . $query . '<br />' . mysql_error()); if(mysql_num_rows($result) == 1) { $row = mysql_fetch_array($result); echo "\n<tr> <td>{$myrow['id']}</td> <td>{$myrow['Address']}</td> <td>{$myrow['City']}</td> <td>{$myrow['Fax']}</td> <td>{$myrow['Specialization']}</td> <td>{$myrow['TargetSalary']}</td> <td>{$myrow['JobType']}</td> <td>{$myrow['WillingToRelocate']}</td> </tr>\n"; } else { echo 'No results returned'; }
-
Do you mean you want to check that whatever you inserted into the database entered successfully?
-
You're almost there. It should be this: Notice the correction is highlighted in red above.
-
Use double quotes when using escaped characters in a string.: $paragraph=$row['paragraph']; $paragraph=str_replace('<br />',"\r\n",$paragraph); But can I ask why you are converting html line breaks back into newlines?
-
You'll want to edit Apache's httpd.conf file which I believe is located in C:/wamp/apache/conf/ Open up the httpd.conf file for editing and find the following line: AddTYpe application/x-httpd-php .php and change it to: AddTYpe application/x-httpd-php .php .php5 Save the httpd.conf file. Now select the WAMP taskbar icon and select the Restart All Services options. .php5 files should now have the PHP code parsed within them when you go to http://localhost
-
[SOLVED] set all session's at once via a array.
wildteen88 replied to redarrow's topic in PHP Coding Help
session() doesn't even exist. To create a session variable you'll use $_SESSION. - Man you been around for awhile you should know by now. Oh and remove the single quotes around the variables in the array. With that correction your code should work. You could even do it like this, no need for the foreach: session_start(); $arr = array('name' => $name, 'pass' => $password, 'msg' => $message); $_SESSION = $arr; -
$data must be an array. From the error you are getting $data is not an array.
-
I would give the generated textareas the same name and end the name with square brackets eg: myTxtAreaName[] That will submit the textareas in an array called myTxtAreaName then us $_POST['txtAreaName'][0] to get the first textarea, $_POST['txtAreaName'][1] for the second etc. Remember arrays start at zero and not 1.
-
[SOLVED] how to print a variable variable $GLOBALS array
wildteen88 replied to dsaba's topic in PHP Coding Help
no, ken said that you don't need to use variables variables you just use $array as a normal index to the $GLOBALS superglobal. You only need to use $array as a variable variable if you wasn't using the $GLOBALS superglobal. -
If you want to get setup quickly then install WAMP. However if you want to learn how to setup Apache, PHP and MySQL then download them individually. Setting up AMP manually is very easy to do but just takes a bit of time to do if you are new to it. However for now you can just setup WAMP if you wish.
-
[SOLVED] PHP Command Line (php.exe) help
wildteen88 replied to techiefreak05's topic in PHP Coding Help
try this. Go to start > Run > type in cmd > Enter Now type the following command: cd C:\wamp\php\ Press enter. This will move the terminal from the default folder (C:\Documents and Settings\<USER>\) to the where PHP is installed to. Which by default is C:/wamp/php when you install WAMP. The terminal should now read this: C:\wamp\php> Now try the PHP help command again: php -h Does that work? -
Either take thorpe's advice, or to take a a screenshot of your code in Dreamwever/Notepad++ and copy 'n' paste it in to MS Word as an image.
-
Try a complete uninstall of Apache rather than using the Repair option. Delete any files/folders left by the Apache uninstaller in C:/Program Files or wherever you installed Apache to. Does Windows load normally now?
-
No its not anything to do with sessions. What you will want to do is use a database which holds image id and all info about that image. In order for PHP to grab all the info for that particular image you want to use some form of identifier. Such as the image id. So your links will be like this: showImage.php?pid=xxx - xxx being the id for that image. In order to get the pid variable in showImage.php you will want to use the $_GET superglobal array. It works the same as $_POST, $_SESSION etc. So to get the pid url variable you will use the following variable: $_GET['pid'] So how do you get PHP to grab all the relevant info for the clicked image. A very simple way would be like the following: <?php // connect to MySQL here // get the vital image identifier (pid) // we also do a bit of validation too. if(isset($_GET['pid']) && is_numeric($_GET['pid'])) { $image_id = $_GET['pid']; } else { die('Invalid image identifier passed'); } // build the SQL query $sql = "SELECT * FROM image_info WHERE img_id = '$image_id' LIMIT 1"; // process the SQL query $qry = mysql_query($sql); // check that the query return 1 result. This is just check that atleast 1 match was found // if no matches where found then pid that was passed was invalid. if(mysql_num_rows($qry) == 1) { // 1 result returned, meaning a match was found // get the return result from the result set ($qry) $row = mysql_fetch_assoc($qry); // here you place the template that shows the info about the image } else { // no matches where found die('No matches found'); } ?> That will be the basics of how to do it. If you do understand the code provided then please say.
-
How to enable PHP in HTML page
wildteen88 replied to mmesarina's topic in PHP Installation and Configuration
You should just add the .html file extension to the AddType not the AddHandler When you added the .html extension to the AddType you did restart Apache? Also what type of PHP tag are you using in example.html? IS it <?php ?>, or <? ?> or something else? Make sure you use the full tags, eg <?php ?>, <?php echo "blah"; ?> rather than the short hand versions <? ?> or <?= ?> -
Try this. Boot into windows using Safe Mode, press F8 before the windows boot loader screen to boot into Safe Mode. When you get on to the desktop go to Start > Run > (type in) services.msc press enter. This will bring up the the Services Manager tool. Look through the list of registered services and select the service named Apache. It should be near the top of the list. Right click on it select properties from the context menu. Now go to the Startup Type pull down menu and choose Manual. Click OK and close all other open windows. What will happen now Windows will not automatically start the Apache service during system startup. Now restart the computer and boot into windows normally, if it comes up with a screen about using the last knowing configuration etc. Do not use that option. Select the boot windows normally option. Can you now get in to Windows with the Apache service now disabled?
-
In that case your HTML is being escaped (converted in to its HTML equivalent) when you store it in the database.
-
If you have HTML within the database then it should be treated as HTML when it is outputted to the browser. However if your HTML is not being parsed by the browser then it seems that you are storing the HTML entity version of the HTML tags, for example rather than storing this: <b>Hello world</b> You are actually storing this: <b>Hello World</b> And so when you output it to the browser you see the HTML code. Try using html_entity_decode when you output your HTML. Does it make a difference?
-
help on enabling mod_rewrite in apache
wildteen88 replied to pixeltrace's topic in Apache HTTP Server
Where are you editing the httpd.conf from? I am not familiar with installing Apache on linux based systems.