Jump to content


Staff Alumni
  • Posts

  • Joined

  • Last visited


Everything posted by aschk

  1. You can't stream images to an image tag without providing some form of timeout refresh...
  2. Why would you want the date to be unique? (as you can see it's giving you an error at the minute).
  3. Is it me or are you inserting $query into $query several times?
  4. Then you're not getting an error... What is being written to the table? Because I suspect the problem is that you're expecting 10 values and only getting 1. Put this at the bottom of your script. <?php echo $value; ?>
  5. In pseudocode... if(agg==1) { $color = blue } elseif(pseudo == 1){ $color = green } elseif(agg == 0 AND pseudo == 0){ $color = red }
  6. Indeed, MySQL interprets anything enclosed by single quote (') as a literal. Thus you weren't actually supplying field names, merely supply strings which happened to contain the name of the field, and what was actually happening would have been that it was doing a comparison, e.g. 'kind_ntf' = '$IDntfK' => would be false So you were in fact probably doing: INSERT INTO notifications SET false, false, false, false, false, false, false Hope that clarifies it for you...
  7. Was that field created by MSSQL? i.e. a custom datatype? Because that's what it appears to be. If so, you will have to create a trigger (in MySQL) to generate this, or (better option) get PHP to generate an ID along the lines of what you were getting before, and insert that into the table.
  8. session_id() merely represents the cookie value for the PHP session identifier. As neil said, "in what way?" would you envisage using session_id() as a security measure? It is already partly a security measure in that the session will correlate to whatever identifier comes from the session_id()...
  9. "Thanks for the suggestion but the value and text must remain different." - why? If you need the text then you might as well make the value and text the same. What could you possibly be using the text for where the value isn't a more pertinent piece of information?
  10. Indeed... You can't have function names the same as PHP keywords. This also applies to "public", "protected", "count", "foreach"... etc. So rename your function to myprivate() or xprivate() or something other than just private()
  11. Yes, because each time you iterate over $totalsx you're getting a copy of $totals, which you are then editing. You're not getting a reference to the internal $totalsx item. Thus you have 2 options. Set it via reference, or via full array path. Both are supplied below: By reference <?php foreach ($totalsx as $key =>&$totals ){ $totals['total'] = "Changed value"; } <?php foreach ($totalsx as $key =>$totals ){ $totalsx[$key]['total'] = "Changed value"; }
  12. After each request you need to update your cookie info, and maintain it, failure to do so could cause a "logout" if the session identifier changes. Are you sure your cookie jar/file is being written correctly?
  13. Are you getting an error or just no results? If the latter (no results) then I suggest you look at what data you are expecting. Run the following with a static "id" value directly in MySQL to see what results you are getting. SELECT * FROM villages_en28 WHERE player = '< PLACE ID HERE >' AND x BETWEEN 400 AND 450 AND y BETWEEN 400 and 450 If you get no results examine why the data doesn't match up. I suspect because there is no player with x and y between those values. Also consider bracketing your SQL for better clarity, e.g. ... AND (x BETWEEN 400 AND 500) AND ...
  14. What information do you want to store? That is your answer
  15. What's the error message? What data do you have? What data are you expecting? What is your schema layout? And as a prelude to you answering the questions above i've written out your query to be more readable (and it would appear i have also corrected your problem...) SELECT u.firstname ,u.lastname ,u.contact ,u.address ,u.email ,v.Vid ,v.name ,v.model ,v.seats FROM user u INNER JOIN vehicle_dtls v ON u.ID = v.ID INNER JOIN tbl_busimage b ON v.Vid= b.Vid WHERE v.route = 'USA-NEWYORK'
  16. This is a formatting issue, not a MySQL issue. MySQL will always give you back a 2-dimensional (spreadsheet like) view of your data. So you need to use PHP (or another scripting language) to parse out the result into the view you want (3-dimensional).
  17. The point Daniel was attempting to make is that you don't need to use PHP at all to calculate the current month. Hence: <?php // No need to calculate current month from PHP as MySQL can do this already. $sql = "Select * from $DB_TBLName2 where vent_today='y' and MONTH(bundle_date) = MONTH(CURDATE())"; The above will work just fine.
  18. A quick alteration to the function supplied by Mark is as follows: function arrayInsertAt($array,$entry,$position) { // At front. if ($position == 0){ array_unshift($array, $entry); return $array; } // At end. if($position == count($position)){ array_push($array, $entry); return $array; } // Greater than end??? if($position > count($position)){ $array[$position] = $entry; return $array; } if ($position > 0) { return array_merge(array_slice($array,0,$position),array($entry),array_slice($array,$position)); } } $testArray = array('Peter','Stewie','Brian'); $testArray = arrayInsertAt($array,'Lois',1); print_r($testArray);
  19. I would still like to point out that your database design is the prime fault here. You shouldn't be having to use eval() to process this information. You should have a normalised schema where you have a table containing key=>value tuples. e.g. Settings table ========================== id | key | value 1 | testvariable | some text 1 | testvariable2 | some more text Where the ID field if a reference to a record in your primary table. Thus you can do: SELECT * FROM settings WHERE id = 1; You can then place all these key=>values into an associative array.
  20. All your DNS supplier can do is point your A/CNAME records to the IP for the server. The webserver (apache?) has to handle the interpretation of the HTTP request into pointing to a particular directory. Hence you will have to tweak the virtual host config, which will require the cooperation of your current host.
  21. Looks fine to me... If you have to a .htaccess you can put the following in it. php_value short_open_tag On
  22. You need to make sure the php module is loaded by apache (assuming you're using apache as your web server).
  23. Do you have your .htaccess (rewrite) rules setup correctly? As gizmola suggested check your apache error logs (or those specific to your vhost setup). Did you use the zf.bat (zf.sh / zf.php) to set up your project/controllers?
  24. Another minor note here, is that if your database field contains the string ' $testMode = "true" ' then your database normalisation/design is faulty. The MySQL column should be a boolean (tinyint) datatype.
  • 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.