jscix
Members-
Posts
197 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
jscix's Achievements
Member (2/5)
0
Reputation
-
-> and :: are simply ways to access a property or function of an object. $this refers to the current object. $show is an instance of an object. $show->BOLDING, is either accessing a method, or property on '$this'
-
if your wanting the file list to update without reloading the page, you'l need to use AJAX. You setup your script that reads the files to output them in html list format, and print them to the page. From your form, on submit, or whatever event handler you want -- make an ajax request to that script
-
[SOLVED] can a session be set even if cookies are disabled in a browser??
jscix replied to mac007's topic in PHP Coding Help
Sessions data is saved server side.. I'm not aware of being able to disable session cookies VIA the web browser, (I know you can CLEAR them), anyway if they could.. the browser would simply not load load the data from the server. and no you can't force a browser to do anything. -
Extracting a file from a directory in a zip file
jscix replied to tcsnguy08's topic in PHP Coding Help
Having no idea how the zip class your using works. I would say to simply unzip the archive to a temporary folder, then manually move the files afterward. -
Yep there is. http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html#operator_or Select * FROM artists where `band` LIKE 'portishead' OR `band` like 'nine inch nails'; Sorry-- Just re-read your post. Yes there is also an XOR operator. Which I believe is just that, 'XOR'
-
Count the total number of rows. Divide that number by 4. You have how many pages you need. EG: [1] - [2] ETC. Add a 'Limit 4' To each query.
-
"There are alot of other languages where understanding OOP is really not the issue. C#, Java, Python, you are an Object Oriented Programmer weather you know it or not" Man, Wrong, wrong, wrong! Programming in an OOP Language does NOT equal programming in an OOP Way! OOP is a methodology which requires alot of practice and thought to do correctly and efficiently.
-
"OOP is just a bunch of methods (functions) and variables put in a single place. Think about it like an fishtank or ecosystem of php code." So, totally, incorrect. OOP is a methodology for implementing functionality in a conceptual way. It enables you program in the terms of your problem by separating design and implementation. It also allows for ease of re-use, redesign and distributed development. One of the best books I've ever read on OOP/OOD is: http://books.google.com/books?id=FnNqkN17kDYC Totally free online. Enjoy!
-
images disappear if file included with require_once
jscix replied to vinpkl's topic in PHP Coding Help
If you use, /path/to/image then your going to have to use the FULL path. /var/www/mywebsite/root/images/image.jpg -
SELECT DATE_FORMAT(CURDATE(), '%d/%m/%Y')
-
For a relatively large website, is it impractical to store a potentially large number of images in the database rather than just storing them in the filesystem?
-
<?php INCLUDE "connect.php"; $host = "host"; $database = "database"; $user = "user"; // I changed these for the post, they're right in my script $pass = "pass"; ConnectToDatabase($database, $user, $pass, $host); $query = "SELECT user, pass FROM users WHERE `user` = '$typed_user'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $database_user == $row['user']; echo($database_user); print "hello, why don't you login? <br />"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Login</title> </head> <body> <form id="login" name="login" method="post" action="login.php"> <label> User <input type="text" name="user" id="user" /> </label> <p> Password <input type="password" name="pass" id = "pass" /> </p> <input type="submit" id="submit" name="sumbit" /> </form> </body> </html> <?php if ($typed_user == $database_user) { echo('Worked!'); } else { echo(' Didn\'t Work!'); } ?>
-
<?php $database = "xxx"; $dbconnect = mysql_pconnect('localhost','xxx','xxx'); mysql_select_db($database, $dbconnect); $query = "select * FROM `products` WHERE `active`='Yes'"; $result = mysql_query($query, $dbconnect); while ($line = mysql_fetch_assoc($result)) { $return[] = $line; } $query2 = mysql_query($query); $seen = array(); $size2 = sizeof($seen); $numberz = $size2; while ($row = mysql_fetch_array($result)) { $cats = explode("|",$row['cats']); $main_cat = $cats[$numberz]; if (!in_array($main_cat,$seen) && !in_array($main_cat,$multiple)) { array_push($seen,$main_cat); } else { array_push($multiple,$main_cat); unset($seen[$main_cat]); } } $size = sizeof($seen); for ($i=0; $i<=$size; $i++) { $product_type = $seen[$i]; } $output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <rss version =\"2.0\" xmlns:g=\"http://base.google.com/ns/1.0\"> <channel> <title>GS Wholesale</title> <description>Your Consumer Electronics and More Store!</description> <link>http://GSWholesale.com</link>"; foreach($return as $line) { $output .= "<item><title>".htmlentities($line['man'])." ".htmlentities($line['mod'])." ".htmlentities($line['name'])."</title> <g:brand>".htmlentities($line['mod'])."</g:brand> <g:condition>new</g:condition> <g:description>".htmlentities($line['specs']).". About the manufacturer ".htmlentities($line['man'])." ".htmlentities($line['full'])."</g:description> <g:model_number>".htmlentities($line['mod'])."</g:model_number> <g:id>".htmlentities($line['mod'])."</g:id> <g:image_link>".htmlentities($line['img_url'])."</g:image_link> <g:pickup>true</g:pickup> <g:link>http://GSWholesale.com/product.php?id=".htmlentities($line['mod'])."</g:link> <g:mpn>".htmlentities($line['mod'])."</g:mpn> <g:price>".htmlentities($line['price'])."</g:price> <g:product_type>".$product_type."</g:product_type> <g:upc>".htmlentities($line['upc'])."</g:upc> <g:quantity>1000</g:quantity> <g:payment_accepted>Google Checkout</g:payment_accepted> <g:payment_accepted>PayPal</g:payment_accepted> <g:payment_accepted>Visa</g:payment_accepted> <g:payment_accepted>Mastercard</g:payment_accepted> <g:payment_accepted>American Express</g:payment_accepted> <g:payment_accepted>Discover</g:payment_accepted> <g:payment_accepted>Cash</g:payment_accepted> <g:payment_accepted>Checks</g:payment_accepted> <g:payment_accepted>Cashiers Checks</g:payment_accepted> <g:payment_accepted>Money Orders</g:payment_accepted> <g:payment_accepted>Wire Transfer</g:payment_accepted> </item>"; } $output .= "</channel></rss>"; header("Content-Type: application/rss+xml"); echo $output; ?> you were trying to use mysql_fetch_row, on a query string. not an actual query. I doubt this alone will fix your issue. but good luck.
-
Switch ($row['rank']) { case '1': $_SESSION['registered']; break; case '2': $_SESSION['member']; break; default: // throw error break } etc
-
Your problem is either: a.) a session value is not getting assigned, you are forgetting to start_session. b.) $row = mysql_fetch_assoc($result); if($row['rank'] == 1) { //set the session and redirect user $_SESSION['registered'] = TRUE; include('info.php'); }else{ //tell the user the account isn't activated if their rank is 0 echo "Your account is not activated"; } This code right here is not being satisfied correct. Eg: Your db value for 'rank' is not set, or not '1'. Thus when, if(isset($_SESSION['registered']) || isset($_SESSION['member']) || isset($_SESSION['moderator']) || isset($_SESSION['admin'])){ Is executed, it is going to return false and return the login form. hope that helps.