-
Posts
4,362 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zane
-
oops sorry...didn't even look at the poster name it's too early for me I'm pretty sure though that this Select User, Number, (Number+1) from Users; isn't the correct syntax...........for addition in SQL
-
if it works for you, then what's the question I'm sure what I gave you will work though
-
SELECT IF(LENGTH(yourCol)>30,CONCAT(SUBSTRING(yourCol,1,30),'....'),yourCol) as theColumn FROM tableX see how that works
-
how are you putting the information into your database most likely your aren't escaping your double quotes you need to put backslashes in front of them when you insert it this is an advert, as \"featured on tv\"
-
notice that if you go here http://www.youngbuddy.com/123.php?go=content/Image.jpg you get this error Parse error: syntax error, unexpected T_STRING in C:\Inetpub\vhosts\youngbuddy.com\httpdocs\Content\Image.jpg on line 30
-
SELECT user, num, SUM(number, 1) as num2 from users
-
$string = " 153277 DATA"; $regs = array(); ereg("(\d*)\n.*href=\"(.*)\".*#.*>(.*) $number = $regs[1]; $url = $regs[2]; $data = $regs[3];
-
use backtics for the field name instead of quotes (`Employee_ID`, `Date`, `Activity`, `Miles`) and put curly braces around the variables VALUES ('{$_employeeid}', '{$_date}', '{$_activity}', '{$_miles}'
-
a good idea is to use a funciton to check it all at once here's a markup I made out of some of it to give you the idea function checkUser($theUser) { $pass = true; /* username is empty */ if (empty($_POST['username'])) $pass = false; /* ... checking if username already exists */ $username_exists = mysql_query("SELECT * FROM users WHERE username='".$_POST['username']."'"); $pass = mysql_num_rows($username_exists) > 0?false:true; /* ... checking if email address is already in use */ $email_exists = mysql_query("SELECT * FROM users WHERE email='".$_POST['email']."'"); $pass = mysql_num_rows($email_exists) > 0?false:true; /* ... checking if email address has been banned */ $banned_exists = mysql_query("SELECT * FROM banned WHERE banned_email='".$_POST['email']."'"); $pass = mysql_num_rows($banned_exists) > 0?false:true; if($theUser == 'admin') $pass == false; return $pass;' } if(checkUser('zanus')) //if it passes then //continue with signup
-
$conn->Execute("INSERT INTO Activity_Log should be $db_conn->.....etc
-
your script will work if you change this line </pre> <form action="WellnessSubmit.php" method="post">< to </pre> <form action="WellnessSubmit.php?action=post" method="post"><
-
http://www.google.com/search?hl=en&q=%281%2F6%29ln%280.97%29&btnG=Search yes
-
Well...I'm sure it all depends on how much space/HD capacity you have to work with as well as the datatypes you're using in the rows MySQL should be able to handle over a billion I got this from http://dev.mysql.com/doc/refman/5.0/en/features.html
-
well, in a sense they could make as many comments as they wanted it's just as soon as their comments went over a certain number it would begin deleting the oldest ones say their limit was 1000 and as soon as began to write what would be 1001 it would delete their very 1st comment bringing them back to 1000 that's the only way I can think of the keep it from getting to a billion
-
Well, you could limit all the users to a set number of comments and perform a query everytime you display them, deleting one to compensate for the limit you gave them if they're past it of course you may want to inform your users
-
I like cmgmyr's brief description OOP is putting a group of related functions in a class...then you can reuse that class later and whatever is in it. Of course it sounds so much better if instead of classes you refer to them objects, which is what they're going to be anyway. Imagine you made an entire ShoppingCart class hell, it might even refer to a bunch of other classes inside of it....for instance a Product class or object.....to go by what I said earlier. The idea here is to be able to create an entire Shopping Cart with just 5 or 6 lines.....not including the lines that make up the ShoppingCart class file. then in your PHP you say...well I'll have my Shopping Cart about right here <?php include 'ShoppingCart.class.php'; $theCart = new ShoppingCart(); //then as you add more products to your cart...assuming you design you Shopping Cart class this way $theCart->addProduct(unserialize($_GET['pid'])); //where $_GET['pid'] is a serialized version of a Product object on some other page it's much better to have one single object to send, rather than a hundred or so $_POST variables
-
^[0-9]{19}$ you can set a range within the braces from whatever to whatever ^[0-9]{1,19}$ will set a range from 1 to 19 numbers
-
To get only the first row you'd do SELECT * FROM table ORDER BY date LIMIT 1;
-
If you're looking to administrate your database then you should look at a few tools out there .... phpMyAdmin http://phpmyadmin.net MySQL Quick Admin http://mysqlquickadmin.com/ if you want to make a PHP script retrieve information out of a database you'll need to look at the mysql_connect, mysql_query, and mysql_fetch_array functions
-
The best advice I can come up with for this one is to make a separate page..........called image.php that takes a $_GET parameter for the image ID like yourdomain.com/image.php?id=15 then on image.php you can have $con = mysql_connect("xxxx","xxxx","xxxx"); mysql_select_db("update1", $con); $sql = mysql_query("SELECT pic FROM pics WHERE num=" . $_GET['id']) or die(mysql_error()); $row = mysql_fetch_array($sql)); //Taken from http://us2.php.net/manual/en/function.imagecreatefromjpeg.php function LoadJpeg($imgname) { $im = @imagecreatefromjpeg($imgname); /* Attempt to open */ if (!$im) { /* See if it failed */ $im = imagecreatetruecolor(150, 30); /* Create a black image */ $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); /* Output an errmsg */ imagestring($im, 1, 5, 5, "Error loading $imgname", $tc); } return $im; } header("Content-Type: image/jpeg"); $img = LoadJpeg("http://www.4tenproductions.com/ir/uploadedfiles2/" . $row['pic']); imagejpeg($img); ?> and then add this to your list of patterns that you have $patterns[3] = '/$replacements[3] = 'echo preg_replace($patterns, $replacements, $string);
-
you need a license from a place like http://www.verisign.com I've never got to play around with such things but I know that's what's involved.
-
do you have your error_reporting set to E_ALL? if not just put this at the top of your script error_reporting(E_ALL); if you don't know that already. and tell us if that gives you anything new
-
put your query in a separate variable to make sure you variables are going through correctly....and also echo the query out just to make sure $query = 'INSERT INTO sigparsed (a, b, c, d, e ) VALUES ("2", $var1, "1", $var2, "0")'; $result= mysql_query($query) or die("Error with your SQL query: " . $query . "\n Error: " . mysql_error());
-
$theFile = pathinfo($_FILES['userfile']['name']); $new_name = basename($theFile['basename'], $theFile['extension']); $new_name .= $user . $theFile['extension']; move_uploaded_file($_FILES["magfile"]["tmp_name"], $new_name);
-
check out bitwise operators http://us.php.net/manual/en/language.operators.bitwise.php I think the one your looking for is the Xor operator