231 Posted Topics
Re: Hey. You'll need and if statement that takes the input value and checks to see what range it's in. Pretty simple really... [CODE] if ($input >= 0 and $input < 10) { echo "Input = 0-9"; } elseif ($input >= 10 and $input < 20) { echo "Input = 10-20"; … ![]() | |
Re: You can have a look at this function I used a while ago to determine the file extension: [CODE] //--- DETERMINES IMAGE EXTENSION ---// function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str)-$i; $exten = substr($str,$i+1,$l); return $exten; } $errors = 0; $filename = … | |
Re: You'd do exactly the same as you would for a normal field. Create the necessary fields using [CODE]<input type="hidden" value="groupX" name="groupX">[/CODE] Then on adminlogin.php get the value of the hidden field: [CODE] $hidden_field = $_POST['groupX']; //Then insert into the database along with the text field as necessary [/CODE] | |
Re: Create an array with all the months in it. Then if 5 is supplied as the month, just access the 5th element of the array. You may want to put a dummy value in location 0 of the array so it makes it a bit easier to access the correct … | |
Re: [CODE] $date = $_POST['date']; $time = $_POST['time']; $datetime = $date ." ". $time; [/CODE] | |
Re: You need to change 'else' to 'elseif' for each of the statements. as hielo suggested, Quotation marks are required around the remark values Also 'totalg' needs the '$' prefix! It is a variable. | |
Re: strange... the code looks okay to me. Maybe start commenting out blocks of code to narrow down where the problem is occurring? | |
Re: I'm not sure, I have never tried passing an array as a URL parameter. However, you could save the array as a session and simply get the contents of it on the payment page. Or even a bunch of hidden fields and get the values through $_post rather than $_get? | |
Re: You can use sessions and/or cookies to accomplish this. E.g: 1. When each user logs in, start a session containing their username. 2. Simply check the content of the session variables to determine who is logged in 3. Close their session when the user has logged out. There is tons … | |
Re: look into cURL. Note that this is horrible, security-wise. | |
Re: Yes of course there is! Although most companies have their own preference of CMS. Drupal, Joomla, Wordpress or their own custom one. So sound knowledge of a few of these, along with other web programming skills would make you desirable. I noticed that it is often the smaller > medium … | |
Re: Use Notepad++ It's by far the best Windows editor in my opinion. XAMPP for windows is also good (and free). It installs Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, Ming, JpGraph, FileZilla FTP Server, mcrypt, … | |
Re: Can you show us an example of what is contained within $thumbnail? Try removing the <br> and the '.=' may want to be changed to '=' You are allowed to use variables in path names. Are you using a windows or linux host? | |
Re: You will need to get a PayPal button from the paypal website. From what I remember, there are two types or button, an encrypted one or an unencrypted one. I think you need an unencrypted one if you wish to plug in your own php variables into the paypal form. … | |
Re: Please remember to wrap your code in [ code ] tags. What exactly do you mean by "everytime i run the sign.php form and i input entries into the form, i get this:" . Does the db connection file have <?php ?> tags?? [CODE]<?php mysql_connect("localhost", "root","mobolaji") or die ("Could not … | |
Re: Don't quote me on this, but I think it's because the array you're passing the foreach loop isn't initialised. I find the following to be interesting in the man page: [CODE]foreach works only on arrays, and will issue an error when you try to use it on a variable with … | |
Re: Welcome asifsomy, well I'm not sure if I'm able to give you a detailed answer, but judging from my previous experience with Wordpress, I found it was quite limited and flat as a development platform. I've heard that alternatives such as Joomla and Drupal have far better project manipulation. If … | |
Re: You will need some sort of regular expression to find the matching word. E.g: [CODE]$i=0; while (there are results) { if(preg_match("/the search term/i", $results[$i], $yellow)) { echo "<span id = "yellow">" $yellow[$i] . $results[$i] ."</span><br>"; } }[/CODE] Not exactly... but you can follow the logic x | |
Re: Hi again, Try this instead. I have used Javascript for the redirect as PHP can sometimes moan about headers: [CODE]if (!$html) { echo 'Incomplete Data, Redirecting...'; Redirect("error.html"); } /** * JavaScript Redirect Function - Redirects the user should the result data be empty * @param string $url the dynamic url … | |
Re: Hi there, I have been doing something similar recently to obtain data contained in an external webpage. I have used the DOMDocument technique to achieve this. Take a look: [CODE] <?php $some_link = 'www.imdb.com/webpage.html'; $tagName = 'div'; $attrName = 'id'; $attrValue = 'tn15title'; $dom = new DOMDocument; $dom->preserveWhiteSpace = false; … | |
Re: [url]http://www.tizag.com/mysqlTutorial/mysqlfetcharray.php[/url] Perhaps you should read this tutorial or something. You need to show some more effort before we can help! | |
Hi all, I have a fairly simple problem. I have an array which prints out the following text: [CODE]1 Full, Gen. 3 TMSWK2D 9 Poor write quality 2 Full, Gen. 1 TMSWK2C Read Only, Clean Tape[/CODE] The problem is after some of the lines of text, there are empty values, … | |
Re: Well a good start would be to post on a Java forum! Good luck x | |
Hi all, I have an array called html which contains rows of text. E.g: [CODE]$html[0] = 1 Full, Gen. 3 TMSWK2D 9 Poor write quality $html[1] = 2 Full, Gen. 1 TMSWK2C Read Only, Clean Tape [/CODE] How would I go about taking each array value and splitting the row … | |
Re: "Permission denied" means that the file that you're trying to read from is protected somehow. Check the properties of that file or directory [CODE]C://xampp/htdocs/ $resource['txt']. [/CODE] | |
Re: You have too many parenthesis after the sql query you have a ")" before the $link variable. Is that $link variable necessary? | |
Hi all, I have a query pulling out dates from a database, these dates are then added to an array and inserted into a graph along the x-axis. From the results, there could be one value with one date or there could be 10 values with one date. This means … | |
Re: Correct me if i'm wrong, but I think it might be because you're trying to print each row as an associative array when the results are returned as mysql_fetch_array. Try this: [CODE] $row=mysql_fetch_assoc($result); while($row = mysql_fetch_assoc($result)) [/CODE] | |
Re: This could be due to a number of things. You may want to be a bit more specific rather than saying "it shows an error when I host it". What is your host? Is the directory structure on your host the same as in WAMPP? Are all the files there? … | |
Re: This is an old function I used to use. Not sure how helpful it will be, but at least it shows how to give the image a unique name using time(): [CODE] <?php define("MAX_SIZE","100"); $errors = 0; if (isset($_POST['upload'])) { $image = $_FILES['image']['name']; if ($image) { $filename = stripslashes($_FILES['image']['name']); $extension … | |
Re: In order for the recipients to be generated dynamically, you will need to do a query to fetch the recipients: [CODE]<?php $query = mysql_query("SELECT email_address FROM table WHERE date = someonesbirthdate"); // while there are result email addresses, add them to the recipients lists while ($results = mysql_fetch_assoc($query)) { // … | |
Re: Undefined index means you're referring to an array with an index value that doesn't exist or can't be recognised. Try putting single quotes around the [CODE]$_POST['$id'];[/CODE] | |
Re: First you will need an action to occur when a button has been clicked. If the html element had a value of 'directors' then you could do something like this: [CODE] $staff=$_POST['directors']; if(isset($staff)) { $sql_query = mysql_query("select * from tablename where fieldname='$staff'") or die (mysql_error()); while ($result = mysql_fetch_assoc($sql_query)) { … | |
Re: I'd stick with Javascript for redirects. [CODE] <?php if($terms == "terms") { Redirect("http://www.romancart.com/checkavailability.asp?storeid=43296"); } // JAVASCRIPT REDIRECT FUNCTION function Redirect($url) { ?> <script type="text/javascript"> window.location = "<?php echo $url ?>" </script> <?php } ?> [/CODE] | |
Hi all, I have a fairly simple question on something I know little about... Is there a PHP equivalent to the Perl POD? We're basically switching over from Perl to PHP but we are struggling to find a PHP-ish way of documenting from within our code. If anyone knows anything … | |
Re: Try: [CODE]<table border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="/_images/nav_divider_white.gif"></td> <?php while ($nav = @mysql_fetch_assoc($navigation)) { if ($nav['fieldname'] == "company") { continue; } ?> ... remaining original code, etc. ... [/CODE] ...Replacing ['fieldname'] with the name of the mysql fieldname that company is located. Also, I can't see where $mainnav and … | |
Hi all, Just installed PHP 5.2.6 on SLES11. I have editted php.ini to try and turn error reporting on, but it's not turning on (I have restarted apache2). At the moment, I'm using php in cli to debug which is getting a bit stale... Here's a section of my php.ini … | |
Re: Sussy, Good question. I'm not 100% sure on how this would work but this article may get you on the right track for how to use sockets and ping. [URL="http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=8&txtCodeId=1786"]http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=8&txtCodeId=1786[/URL] | |
Re: You're going to need to be a bit more specific in order for people to help! | |
Re: I'm not sure entirely what you're trying to accomplish, but could this work? [CODE] $query = "SELECT SearchString,Count(SearchID) FROM SearchString GROUP BY SearchString"; $result = odbc_exec($conn,$query); // Print out result $i = 0; while($fetch=odbc_fetch_array($result)){ echo "There area total of ". $fetch[$i] ." Searches for ". $fetch['SearchString'] ."."; echo "<br />"; … | |
Re: Hey aycmike. I know when I started learning I used a book called PHP and MySQL Web Development by luke welling and laura thomson which has lots of examples. Try and get the third/fourth edition though - you can get it second hand from Amazon for a decent price. There's … | |
Re: Acute, I adopted this one for one of my projects. It worked pretty well [URL="http://evolt.org/node/60265/"]http://evolt.org/node/60265/[/URL] | |
Re: You are probably missing an ending quote (") somewhere in your code. A missed end brace "}", bracket "]", or parenthesis ")" can also cause the unexpected $end in a script as well. | |
Re: [CODE] <?php $username = $_POST['username']; $password = $_POST['password']; if (!$username or !$password) { echo 'make sure you entered the required fields'; exit(0); } $query = "SELECT password FROM table WHERE userId = '$username'"; $dbarray = mysql_fetch_array($query); if ($password == $dbarray['u_passwd']) { echo 'Password match'; } else { echo 'Password Fail'; … ![]() | |
Hey guys, Apologies if this is posted in the wrong place, but couldn't find a suitable forum. Basically I'm making a website for a musician, and was contemplating using WordPress to allow him to be able to manage his own updates, as well as update his image gallery, new videos … | |
hey guys, I'm trying to simply use the mail function. I'm using ubuntu 8.10 and have installed sendmail. My php.ini config is: [CODE]; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). sendmail_path = /usr/sbin/sendmail -t -i[/CODE] and for testing purposes my php is: [CODE]$to = … ![]() | |
Re: Do you have session_start(); at the top of your script? | |
If I have a table sales: sales {sellerid, buyerid} I'm trying to determine the buyers favourite seller... So I need to return the most frequent sellerid. I've used this query to find out the total number of times the buyer has bought something from any seller: [CODE]$countseller = mysql_query("SELECT count(sellerid) … | |
Hey everyone. I'm having some trouble returning the correct number of matched results after a search query is issued to my site's search bar. I was using this, but it returns the wrong number of matches (only for certain queries): [CODE] $countofrecs = mysql_query("SELECT count(*) from tablename WHERE title OR … |
The End.