Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
if (strtolower($_POST['security']) != 'wet'){
-
If you're talking about help-desk ticket system, I've had good experiences with http://www.accord5.com/trellis
-
Okay, then in bulletin.php: <?php if(!isset($church)) $church=$_GET['church']; ?>
-
Jaws theme song. Don't ask, because I don't know.
-
Change: $query = "INSERT INTO $tbl_name (id, date, chk, cat, sub_cat, desc, amount) VALUES ('NULL','".$exp_date."','".$exp_chk."','".$exp_cat."','".$exp_sub_cat."','".$exp_description."','".$exp_amount."')"; to: $query = "INSERT INTO `$tbl_name` (`id`, `date`, `chk`, `cat`, `sub_cat`, `desc`, `amount`) VALUES ('NULL','".$exp_date."','".$exp_chk."','".$exp_cat."','".$exp_sub_cat."','".$exp_description."','".$exp_amount."')"; echo $query; I believe it's because desc wasn't in the backticks (`) and it is a keyword (for ordering)
-
<?php $church = 1; include "bulletin.php"; ?> In bulletin.php, you can get rid of: <?php $church=$_GET[church]; ?>
-
[SOLVED] Im just starting to learn php and.....
Philip replied to pmwilson515's topic in PHP Coding Help
For ease, you can look into LAMP, WAMP, or XAMPP. All will install apache, mysql, and php all at once Also, take a look at some PHP IDE's. They can really make coding a lot easier -
[SOLVED] Im just starting to learn php and.....
Philip replied to pmwilson515's topic in PHP Coding Help
Yeah there is - but it's a ridiculous number, like 4 billion rows (not limited by data size) per table. I don't think you'd really have to worry about that. I'd seriously suggest looking into MySQL, it's one of the most popular database systems to use with PHP. If you ever get stuck using it, I doubt you'd run out of places to look for help -
[SOLVED] Im just starting to learn php and.....
Philip replied to pmwilson515's topic in PHP Coding Help
isn't MySql starting to charge for their services now?.... But I found Microsoft Sql 2005 Express, would that work? I don't know where you heard that at. After all, on their website it boldly states at the top: They do charge for support/enterprise features, but not for the normal everyday use edition -
Because include is looking for the file "bulletin.php?church=1" not "bulletin.php" You could always do : <?php $bar = 'test'; include 'foo.php'; ?> in foo.php: <?php echo $bar; // echo's test ?>
-
What is , ("text"); supposed to be?
-
Pretty much right, but for myself I would do a return with an array of the variables instead of using global. <?php function ui($user) { // added limit 1, since you only need one row, yes? $query = "select * from users where username = '".$user."' LIMIT 1"; $result = mysql_query($query) or die ("Could not match data because ".mysql_error()); // if there weren't any rows, return false, otherwise return the array if(mysql_num_rows($result) < 1) return false; else return mysql_fetch_array($result); } // call functions $userInfo = ui('some_username'); // if it was returned as an array, we have data! if(is_array($userInfo)) print_r($userInfo); else echo 'no data for this user!'; ?>
-
[SOLVED] Trying to collect data from the URL
Philip replied to nayrufyoradin's topic in PHP Coding Help
You have it as if(empty($_POST)) { ... but then try to call a value from post $type = $_POST['type']; So you're not getting the $type, and not getting the "FROM tablename" in your query -
[SOLVED] accessing the array value witout putting it in another variable
Philip replied to asmith's topic in PHP Coding Help
This works, but really isn't as efficient as just creating a variable $a = 'The text must be exploded'; echo implode(array_slice(explode(' ',$a),2,1)); -
[SOLVED] Trying to collect data from the URL
Philip replied to nayrufyoradin's topic in PHP Coding Help
It is giving you that error because $title wasn't set because you have it being set when !empty($_POST) A workaround is on the fields have something like: <dd><input type="text" name="title" id="title" value="<?php if(isset($title)) echo $title; ?>" /></dd> -
[SOLVED] Trying to collect data from the URL
Philip replied to nayrufyoradin's topic in PHP Coding Help
Thats fine Just use tags -
[SOLVED] Trying to collect data from the URL
Philip replied to nayrufyoradin's topic in PHP Coding Help
if ($type = "gallery"){ $sql = "INSERT INTO img_gallery "; } if ($type = "sketches"){ $sql = "INSERT INTO img_sketches "; } should be (notice the ==, not =): if ($type == "gallery"){ $sql = "INSERT INTO img_gallery "; } if ($type == "sketches"){ $sql = "INSERT INTO img_sketches "; } Also, here's how I would design that using a switch (makes it easier to see & add more in options in the future): <?php switch($_GET['type']) { case 'gallery': $sql = "INSERT INTO img_gallery "; break; case 'sketches': $sql = "INSERT INTO img_sketches "; break; case 'another': default: // (in case the url variable doesn't match, what should it do? // this is where default comes in really handy // for an example, we'll use one from above: $sql = "INSERT INTO img_sketches "; break; } ?> edit: fixed a few typos + added switch statement code -
[SOLVED] How to set display order of while loop
Philip replied to phpdragon's topic in PHP Coding Help
order by -
You're not getting any POST data, from the user. That's why they are "undefined index" errors. How are you submitting the data to that page?
-
Above: $topic=$_POST['topic']; $detail=$_POST['detail']; $name=$_POST['name']; $email=$_POST['email']; put this: echo '<pre>'; print_r($_POST); echo '</pre>'; // post fields here... And copy/paste what that outputs
-
printf is for formatting a string, while print_r will return a human readable variable dump.
-
It should be: $vars = $_REQUEST; foreach($vars as $key => $var) { echo "Passed Name: ".$key."; Value: ".$var; } I prefer: echo '<pre>'; print_r($_REQUEST); echo '</pre>'; Although use of REQUEST can be iffy and unsecure (as with all user inputs)
-
You need a period [.] before the $rows $qry="SELECT * FROM `members` WHERE `username`='".$rows['user']."'";
-
Session register is deprecated, and you aren't using quotes around the index. session_start(); $_SESSION['id'] = "foo"; $hi = $_SESSION['id']; echo $hi; // shows 'foo' @OP, any reason to why you're trying to call the session id? <?php session_start(); $_SESSION['myVar']="hello" ; // don't really need this $sessId=session_id(); echo "<br> sessId: " . $sessId . "<br>" ; print('<iframe name="test" id="test" src="foo/bar.php" marginwidth=0 marginheight=0 onload="this.height=this.contentDocument.height" width="100%" frameborder="0" scrolling="yes"></iframe>'); ?> <?php session_start(); if(!isset($_SESSION['myVar']) || empty($_SESSION['myVar'])) { echo "<pre>" ; print_r($_SESSION); echo '</pre>'; } else { //something } ?>
-
Change: <?php if(empty($_GET['ID'])) to: <?php print_r($_GET); if(empty($_GET['ID'])) And double check to make sure that get index is correct. Just as a reminder, ID is not the same as id. It is case sensitive