Jump to content

Shazer2

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by Shazer2

  1. That inspires me, that's sort of like things I want to learn about.
  2. Maybe like function execution time, and timing different things. Analytics too I guess.
  3. I was just reading an interview with an Engineer from Facebook. He has a very interesting sounding job, and I want to look into new areas of PHP and expand on my Javascript knowledge as well. I want to start doing statistic work, putting it in graphs, measuring stuff and solving problems. How can I start?
  4. Thanks SergeiSS, I had to CHMOD to 666 to write to it. Thanks.
  5. I'm trying to write to a file with the following code. $fh = fopen("../inc/config.php", "a") or die("\r\nCan't open file."); $write = "\$config['database_host'] = {$mysqlh}; \$config['database_user'] = {$mysqlu}; \$config['datbase_pass'] = {$mysqlp}; \$config['datbase_name'] = {$dbn}; \$config['table_prefix'] = {$tp};"; fwrite($fh, $write); fclose($fh); It is printing out "Can't open file", which I guess means it can't find the file or I've given the wrong path. The file that is executing this code is /install and the file I'm trying to write to is /inc/config.php. I thought .. put you up a directory so if I do .. I will be at the root and then do /inc I will be in inc. Can someone please guide me on what I'm doing wrong? Thanks.
  6. I figured it out, I guess I wasn't connecting OR selecting a database as in the construct for my DB class I was doing. function __construct() { return self::connect(); return self::select_db(); } Instead of function __construct() { self::connect(); self::select_db(); } I changed it to the second code, and now everything works fine. Thanks for all the help!
  7. I just realised a few things, firstly I wasn't selecting a database and secondly I had the wrong table name. I corrected both but I'm still getting this error. Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/shannon/public_html/booter/inc/classes/class.db.php on line 18
  8. I fixed it all up. Thanks anyway for all the help.
  9. Sorry, this is the function. function select($table, $rows = "*", $cond = "") { $query = "SELECT {$rows} FROM `{$table}`"; if ($cond != "") { $query .= " WHERE {$cond}"; } return mysql_query($query); }
  10. Well I'm calling it like this: $query = $db->select("boot", "id, uid", "id=1"); while ($rows = $db->fetch_array($query)) { echo $rows['id']." - ".$rows['uid']; }
  11. Actually, why do you need the foreach, the while loop loops through it all anyway.
  12. $cemail = mysql_real_escape_string($_POST['customere-email']); $query = "SELECT * FROM orders WHERE customeremail = '{$cemail}'"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { if ($row['customeremail'] != "") { foreach ($row['id'] as $whatever) { echo "lol"; } } } Try that code. Untested, but should work.
  13. So like appending to a text file each time someone submits? Wouldn't that be pretty inefficient?
  14. Shouldn't it be $_SERVER['PHP_SELF'] instead of $PHP_SELF?
  15. Just get a textarea made, a submit button and put the posted comment into the database, and for viewing comments just do a select query.
  16. I am receiving this error: Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/shannon/public_html/booter/inc/classes/class.db.php on line 17 For the function: function fetch_array($query) { $array = mysql_fetch_assoc($query); return $array; } Why would I receive that error, if I am just passing a variable? Not a resource or boolean? Thanks.
  17. I have no idea how I missed that, thanks heaps. Yeah, I will, I wasn't up to that yet though.
  18. Alright, I copied that code directly and then done: echo $db->select("boot", "id", "id=1"); The output is "not array".
  19. Well I had this code before: $check = is_array($rows) ? "Yes" : "No"; echo $check; It responded with no.
  20. I am designing my own framework, and I have created a select function. I have set a parameter to be an array by default, with the default value of *. When I check if it's an array (with is_array) it says that it isn't. Does anyone have any idea why it would say that? function select($table, $rows = array('*'), $cond = "") { $query = "SELECT {$rows} FROM `{$table}`"; if (isset($cond)) { $query .= " WHERE {$cond}"; } if (is_array($rows)) { if (isset($rows) && $rows != "*") { foreach ($rows as $v) { print_r($v); } } } //return mysql_query($query); } Any help is appreciated. Thanks.
×
×
  • 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.