Jump to content

Guardian-Mage

Members
  • Posts

    341
  • Joined

  • Last visited

    Never

Everything posted by Guardian-Mage

  1. That wouldn't fix the problem because of where the error is occuring. It is not occuring in the data field section, but in the column name section. -Guardian Mage
  2. I believe one of your column names is a reserved syntax word. To avoid this, surround the column names with a backtick, `, and values with a single quote, '. <?php $query = "INSERT INTO `equipment` (`DistrictTag`, `SerialNumber`, `Type`, `Type1`, `Model`, `DateofPurchase`, `Grant`, `Building`, `Room`, `Status`, `Specs`, `WorkedOn`) VALUES('$districtId', '$serialId', '$type', '$type1', '$model', '$dateofPurcahse', '$grant', '$building', '$room', '$status', '$specs', '$workedOn');"; echo "<br /><br />"; mysql_query($query, $db) or die(mysql_error($db) . '<br />' . $query); ?> Oh, and Google would have given you the answers to your question You might consider reading a book on SQL, a lot of people don't know how to use SQL properly.
  3. @ Crayon Violent You got what I was doing dead on. I don't care what the value ACTUALLY is, only that it is one of the given values. I use strtolower already, and I don't care if it is TRUE, true, TRuE, or tRuE. As long as it is true or false, another part of my program looks at the actual value. @ nrg_alpha It probably doesn't have to use preg_match, but this is how I set my program up. I have an array similar to this: $this->CONFIGURATION_TYPES = array(); $this->CONFIGURATION_TYPES[0] = array("boolean","/^(true|false|0|1)$/"); $this->CONFIGURATION_TYPES[1] = array("integer","/^[0-9]$/"); //More code here Which makes the code easy to extend. Hopefully you get the idea, I left a lot of code out
  4. The way I have designed my program, and the fact that using preg match was the easiest solution. I am writing an interpreter, and I have an array of datatypes. It contains the name (boolean for example), and the regular expression that is used to verify the data. Thanks for the solution, it works well.
  5. How can I use preg match to see if a string is EQUAL to (Not contains) the string "false" or "true"? I have to use preg match, so that is the only solution I am looking for Thanks
  6. http://www.mikelipkin.com/images/but_about.gif I REALLY need to know the font used here, or something that matches it closely. Thanks
  7. downloading imagick-2.2.1.tgz ... Starting to download imagick-2.2.1.tgz (75,873 bytes) .................done: 75,873 bytes 11 source files, building running: phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 ERROR: `phpize' failed Whenever I try to install imagemagick for php I get the above error. I am running XAMPP on Ubuntu 8.10. All I care about is installing imagemagick so PHP can use it, so if anyone knows how to do that, please tell me.
  8. I am no expert with PHP time, but shouldn't it be: $test = gtu("10/20/2008"); echo $test; See the quotes? EDIT: Just tried it, and the quotes fixed it
  9. I would do it by putting the list of variable names in an array. Then use this code: $varArray = array("icufellow","staff","column3","column4","etc"); $varArraySize = count($varArray); echo "<table>"; for ($i = 0; $i < varArraySize;$i++) { echo "<tr>"; for ($f = 1; $f < 32; $f++) { echo "<td> " . $row[$varArray[$i] . $f] . "</td>"; } echo "</tr>"; } echo "</table>"; Don't forget to add your SQL code @DarkWater Thanks for the tip -Brandon
  10. I actually found and a solution thanks. Everything on the server was disabled. NO system commands, shell commands, no zip, tar, etc libs, and the final file had to be just that. One file.
  11. I have 64 bit os, and this was a one time thing. This was the only solution.
  12. How might I go about executing a 2.4 gig php file? It contains the encoded version of an entire directory structure. The script is designed to unpack and recreate this directory structure. No I can't do it any other way. I need to use this file. Any suggestions? I get the following error when trying to run the file directly Warning: Unknown: failed to open stream: Value too large for defined data type in Unknown on line 0 Fatal error: Unknown: Failed opening required '/home2/codespin/public_html/openaurora.org/file.php' (include_path='.:/opt/lampp/lib/php') in Unknown on line 0
  13. Really easy to do. Using Paypal's ipn, have it open a page on your site which extracts an email, creates a random password, and stores it in a database, then emails the user the password. The user needs to enter the url in the download address to be able to access the files. If you need source code, PM me, and I can help you out.
  14. You need to urlencode the slashes in the url. http://ca.php.net/manual/en/function.urlencode.php
  15. login page <?php $PASSWORD = "secret password here"; if (isset($_POST['pass'])) { if ($_POST['pass']) == $PASSWORD) { session_start(); $_SESSION['pass'] = true; header("Location: other_page_path_here.php"); exit(); } else { echo <<<ABC <strong style="color:red;">Looks like you entered the wrong password</strong> <form method="post"> <input type="password" name="pass" /> <input type="submit" value="Login" /> </form> ABC; } } else { echo <<<ABC <form method="post"> <input type="password" name="pass" /> <input type="submit" value="Login" /> </form> ABC; } ?> other page <?php session_start(); if (!isset($_SESSION['pass'])) { //Without a password, redirect to login script header("Location: login_script_path_here.php"); exit(); } ?> //HTML And rest of page here
  16. Actually no, he is using a php variable in javascript; //it goes wrong here- the filename is just given as filecount.jpg function showLastPicture($filecount) { imageCount= '$filecount'; //PROBLEM HERE, IT NEEDS TO BE imageCount= '<?php echo $filecount ?>'; var fileName="images/image"+imageCount+".jpg"; document.getElementById('plaatje').src=fileName; }
  17. If you know the absolute path (The path from root) then just use that. E.g include("/opt/lampp/htdocs/db.conf.php");
  18. I couldn't get those to work. What about coming up with the name?
  19. Right now I have a basic script to get a list of drives when running Windows: <?php $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; for ($i = 0;$i<26;$i++){ $t = substr($str,$i,1); if (is_dir($t . ":")) { echo $t; } } exit; ?> Is there a way to do this faster, and how might I get the actual name of the drive?
  20. Well as far as I know it is impossible to make them into an EXE. You could try PHP GTK, it allows you to make applications using PHP, that run in windows.
  21. http://www.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart Also, you shouldn't have to ask if you have the skills to do the project. All you need is a database, some PHP code, and your set. If your going with PayPal you need an account, as well as a public certificate. If you are interested in a minimalistic shopping cart using PayPal, PM me, I made the one on the following site from scratch and I will give you the full source code: http://globaltrainingedge.com/cart/ The code is only a few hundred lines, and works with 1 mysql database.
  22. The ceil errors are probably caused by bad coding, because I am not aware of any significant changes to those functions between versions. However, there are a GREAT many differences between the two, especially with OOP.
  23. Do you know where it is redirecting you? The url you put in? Also, put echo then exit statements in your script. Keep moving it down. It should help you pinpoint the code causing the redirection, because if no redirection occurs, then you move the echo statement down 1 line, and keep trying. It make take a while for larger scripts, but for something small like this, it works great. Also, please put your code in [ code ] tags
  24. SQL queries have something called like, which allow for the user of a wildcard '%'. Wildcards will match all characters, or only 1 depending on the wild card. So if you wanted to search for users with the search word anywhere in their name, you could do this: $keyword = $_POST['keyword']; //This is the value from the search box $query1 = "SELECT `username`,`id` FROM `users` WHERE `username` LIKE '%$keyword%'"; $execute1 = mysql_query($query1) or die("Oops, looks like there was an error<br /><br />" . mysql_error()); while ($i = mysql_fetch_row($execute1)) { echo $i[0] . "<br />"; }
  25. IF you do want to use a completely random number like the last poster suggested just use this function function create_random_str($length){ $src = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ@_'; $len = strlen($src) - 1; $randstr = ""; for($i=0; $i<$length; $i++) { $x = rand(0,$len); $randstr .= $src{$x}; } return $randstr; }
×
×
  • 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.