Jump to content

EmperorJazzy

Members
  • Posts

    72
  • Joined

  • Last visited

    Never

Everything posted by EmperorJazzy

  1. Ok; Dumb question. Do I need my hosting to support jQuery because I can't get the bugger to work (even using this guys demo)
  2. So I'm writing code to read from the DB Table both the TITLE and the DETAIL of the records. (This will be refined to selective SQL, but currently in TEST). I'm returning both fields and displaying them currently; TITLE VALUE - DETAIL VALUE (TITLE Field = 255 Char) (DETAIL Field = No Limit; Full Text) I'd like to display a TABLE of TITLE VALUES, and when clicked, it shows the DETAIL VALUE. It's the classic Hide/Show dynamic. Essentially; I could accomplish this by refreshing the page each time however, usability = YUK. Does someone have an example or LINK I could follow to learn more.
  3. Hi All, I'm having a major mind blank, and can't find anything in the previous posts resolving what I'm after. I'm setting $searchtext = $_POST['searchtext']; I want to check $seachtext is not null. I've seen isset($searchtext) but it doesn't solve my problem. Basiclaly; I want an if statement to say if(isset($searchtext)) {......} Thoughts?
  4. Might I suggest; $query = "SELECT FLIGHT_NO FROM FLIGHTS WHERE FLIGHT_NO = " . $flightno; Call the function for the query results If recordcount > 0 Then insert else dont insert It's not ONE LINE, but you could combine them together, however, it wouldn't be prudent to combine into one line as it'll make it harder to debug.
  5. Oh remove the = from that line
  6. Try this.... <html> <body> <form action="insert.php" method="post"> name: <input type="text" name="name" /> email: <input type="text" name="email" /> password: <input type="text" name="password" /> <input type="submit" /> </form> </body> </html> <?php $link = mysqli_connect('localhost','test',''); if (!$link) { die('Could not connect to MySQL: ' . mysql_error()); } $con = mysqli_connect($link); $sql="INSERT INTO emails (name,email, password) VALUES ('$_POST[name]','$_POST[email]','$_POST[password]')"; mysqli_query=($con, $sql); mysqli_close($con); ?>
  7. When a link is clicked on one page (listing page), and I want to open it in a new window, I'd like to have a title section across the top say height=30, and the linked web page displayed below. I've been researching and have found that both file_get_contents or iframes could do the job. I briefly attempted iframes src=x but after loading, the web page takes over the browser and the title section disappears. Can I use file_get_contents to display the web page as it's written below the title section? I've seen someone mention using a DIV for it. Could someone provide some guidance? BTW: the title section is going to be used to allow the user to select an alert to be set in my database. But also have the option to 'hide'. Thanks!
  8. We have a button for that. Where? I went looking for it and couldn't find it?
  9. So I'm reading a JSON, and I'm using the command GET_FILE_CONTENTS, and I'm getting results. However, the JSON is incomplete to a point where in some instances the variables/objects within do not always contain a certain array. Issue; I'm getting errors returned when that particular array does not exist. The code below is the line that's getting the error returned because the TAGS[0] doesn't exist in all instances. Question; How do I check if the array exists within the GET_FILE_CONTENTS object? See example; If($dall->tags[0]->name==$catgrp) Error: Notice: Undefined offset: 0 in /var/www/vhosts/website/httpdocs/testjson/index.php on line 63 Notice: Trying to get property of non-object in /var/www/vhosts/website/httpdocs/testjson/index.php on line 63
  10. So I have 2 queries, that has the potential to return alot of data, foreach loops running. The first shows each group heading, and the foreach nested is calling another query specific to the group heading. The result currently is a lengthy delay in results showing. (Now this may/may not be the most ideal code practise in this instance however... short term solution discussion please). For Each State Read Each States Details from DB For Each State Listing Display Details Next Next Is there a command or other where I can say, Display HTML page as it stands while it continues to process the FOREACH loops? EG: For Each State Read Each States Details from DB For Each State Listing Display Details REFRESH HTML DISPLAYED Next Next
  11. Evening All, So I have 2 JSON foreach loops running. The first shows each group heading, and the foreach nested is calling another JSON specific to the group heading. The result currently is a lengthy delay in results showing. (Now this may/may not be the most ideal code practise in this instance however... short term solution discussion please). For Each State Read Each States Details from JSON For Each State Listing Display Details Next Next Is there a command/jscript or other where I can say, Display HTML page as it stands while it continues to process the FOREACH loops? EG: For Each State Read Each States Details from JSON For Each State Listing Display Details REFRESH HTML DISPLAYED Next Next
  12. Arh, so very true. Always good to have another set of eyes over my code. Thanks! Is any of our wonderful moderators/guru's able to point me in the right direction for a tutorial on PHP and JSON so I can learn without constant posting on the forum. Thanks in advance!
  13. jackr1909; Add the following lines to your file and rerun. ini_set ("display_errors", "1"); error_reporting(E_ALL); Example: <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); $redirect_page = "fail.php"; if(in_array($_GET['svalue'], array('Search', 'search')){ $redirect_page = "index.html"; } header("Location: " . $redirect_page); echo "not working" ?>
  14. I've done a similar thing with editing of records and as WebStyles says; use a hidden element.
  15. Evening All, I'm noob to the JSON stuff; and trying to learn (if anyone has a php tutorial I'd be appreciative if you could let me know). I've written some basic code to begin breaking down the process I want to achieve. The following is an extract where I'm simply trying to call the .json output and var_dump'ing it. The output error is below; <body> <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); $jsonFile = file_get_contents('http://api.xxxxxx.com/xxxxxxx.json?client_id=975a48c6c927c42c91cxc2348eafc9766d44892d'); $json = json_decode($jsonFile, true); var_dump(json_decode($json)); var_dump(json_decode($json, true)); ?> </body> Error [code] Warning: json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/einterfaces.com.au/httpdocs/testjson/index.php on line 15 NULL Warning: json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/einterfaces.com.au/httpdocs/testjson/index.php on line 16 NULL The file itself may contain header information. Expected output: HTTP/1.1 200 OK X-Runtime: 139 ETag: "02023e97fc389c84f74e7b1ed9d9899e" X-L-COOKIE: X-RateLimit-Client-RateLimit: 2500 Content-Length: 40060 X-UA-Compatible: chrome=IE8 Set-Cookie: _thepoint=e9d7f8167176b1e716644592e770eb09; domain=.xxxxxx.com; path=/; expires=Thu, 23 Jun 2011 10:25:42 GMT; HttpOnly X-RateLimit-IP-RateResetsAt: 2011-06-22T10:26:42Z Connection: close Server: nginx/0.7.65 Cache-Control: private, max-age=0, must-revalidate X-RateLimit-IP-RateRemaining: 600 X-RateLimit-Client-RateRemaining: 2440 Status: 200 X-RateLimit-IP-RateLimit: 600 X-RateLimit-Client-RateResetsAt: 2011-06-22T10:26:42Z Date: Wed, 22 Jun 2011 10:25:42 GMT Content-Type: application/json; charset=utf-8 { "divisions": [ { "id" : "abbotsford", "name" : "Abbotsford", "country" : "Canada", "timezone" : "Pacific Time (US & Canada)", "timezoneOffsetInSeconds" : -28800, "lat" : 49.0568, "lng" : -122.285, "isNowMerchantEnabled" : false, "isNowCustomerEnabled" : false, "areas": [ ] }, .... Again... I am totally noob at this. Thanks in advance for your advice.
  16. Any chance of posting the successful code for learning experiences?
  17. Ok; strange, but could you try renaming the table to tblOrders or alternatively, using [orders] for the table name.
  18. Exactly what I was looking for. Thank you.[/code]
  19. Hey Vultima, Try adding the following echo line to your code; it may help determine if the query string is a problem. $sql="INSERT INTO order (Firstname, surname, telephone, email, title, description) VALUES ('$_POST[name]','$_POST[lname]','$_POST[tele]','$_POST[mail]','$_POST[title]','$_POST[descriptions]')"; echo $sql; I would comment out the execution and Die for the moment. //if (!mysql_query($sql,$con)) // { //die('Error: ' . mysql_error()); //} //echo "Order Has been Submitted, Being Redirected in 5 Seconds"; Post your result.
  20. So essentially there is no syntax similar to the following without having to use the WHILE loop each time; $query = ..... $result = ...... echo "Number of records = " . $result['cnt']; Or could I simply use the mysqli_num_rows()?
  21. Maq - Appreciate it; apologies, I omitted the SQL with the COUNT function (now included). The question is orientated around the PHP syntax.
  22. At present, all my queries return multiple records. Now I want to do a record count, and only return the one record. Current Code $query = "SELECT * FROM tblListField WHERE ListID = '" . $_SESSION['listid'] . "'"; $result = mysqli_query($dbc, $query) or die('Error executing SELECT * statement for tblListField - ' . $query); if(mysqli_num_rows($result)) { // at least one row, process the data from the query while ($row = mysqli_fetch_array($result)) { So the above runs through each record; what do I use to get the one record from the following SQL? (Note; I'm using mysqli_) $query = "SELECT COUNT(ItemField_1) WHERE ListID='" . $listid . "'";
  23. So... <?php while ($listid='') { $listtest = rand(1000000000,9999999999); $query = "SELECT ListID FROM tblUserList WHERE ListID='" . $listtest . "'"; $result = mysqli_query($dbc, $query) or die('Error checking ListID - ' . $query); $row_cnt = mysqli_num_rows($result) If ($row_cnt==0) { $listid=$listtest; } } ?> Should I also use the == for the while statement? <?php while ($listid=='') ?>
×
×
  • 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.