Jump to content

andy_b42

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Everything posted by andy_b42

  1. Can you provide more details of all of the fields in your tables.
  2. Correct me if i am wrong, but i believe adding in a WHERE clause requires that arguments be supplied, i think the code above would just error as soon as the database attempted to execute the query. gple, if you remove your where clause completely, youshould get back all of the results in the table e.g. mysql_query("select * from table")
  3. Actually, unless i am missing something, this sql string doesnt ask for the image_url field from the database $sql = "SELECT Title,Content,Date FROM Posts ORDER BY id DESC";
  4. Can you try adding in the line: echo $pic; just after: $pic = $feed['image_url']; to see what url you are actually putting into the img tag
  5. By the looks of it, there are 4 "{" in this section and only 3 "}", i suspect it has something to do with the line "if(mysql_num_rows($fixtures)==0) ", not really read through what your code is trying to do though <?php if (isset ($message)) { echo($message); } else { echo('<form method="post" action="add_report.php">'); echo('<table>'); echo ('<tr><td><select name="match"><option>Please select Fixture</option>'); $fixtures=mysql_query('SELECT * FROM `tbl_fixture_dates` INNER JOIN `tbl_fixtures` ON `tbl_fixture_dates`.`date_id` = `tbl_fixtures`.`date_id` WHERE `tbl_fixtures`.`team_id` = \'' . $_GET['team_id'] . '\' order by match_date'); if(mysql_num_rows($fixtures)==0) echo('<option>there is no data in table..</option>'); else { while($matchrow=mysql_fetch_assoc($fixtures)) { echo "<option value=".$matchrow[match_id].">".date("d-M-Y", strtotime($matchrow[Date]))."|".$matchrow[Opposition]."</option>"; } } echo ('</select></td></tr>'); echo('<tr><td><input name="title" type="text" value="Enter Headline Here..." size="70" class="button"/></td></tr>'); echo ('<tr><td>'); $oFCKeditor = new FCKeditor('fcktext'); $oFCKeditor->BasePath = "includes/fckeditor/"; $oFCKeditor->Value = ""; $oFCKeditor->Width = 540; $oFCKeditor->Height = 400; echo $oFCKeditor->CreateHtml(); echo ('</td></tr>'); echo ('<br /> '); echo('<tr><td><input type="hidden" name="submit_form" value="1" /> </td></tr> <tr><td><input type="submit" value="Save Post" class="button"/> </td></tr> </table> </form>'); ?>
  6. and also the two similar ones below: <?php echo $myrow["title"] ?> <?php echo $myrow["who"] ?>
  7. on quick glance i would say this line: <input type=hidden name="id" value="<?php echo $myrow["id"] ?>"> needs a ";" after echo $myrow["id"]
  8. http://uk.php.net/round something like: round($value, 2);
  9. Solved, i was joining my tables on the table name and not the constraint name (which is where i should have been joining). Incase this is of use to anyone: SELECT kcu.COLUMN_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu ON tc.CONSTRAINT_NAME = kcu.CONSTRAINT_NAME WHERE tc.CONSTRAINT_TYPE = 'PRIMARY KEY' AND tc.TABLE_NAME = 'table1'
  10. I've been looking how to find the Primary Key of a table similar to the mysql equivalent of something like show keys from table1 where Key_name = 'primary' So far i have got this stage: SELECT kcu.COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc on kcu.TABLE_NAME = tc.TABLE_NAME WHERE tc.CONSTRAINT_TYPE = 'PRIMARY KEY' AND kcu.TABLE_NAME = 'table1' However, if the table contains a Foreign Key field that is a Primary Key on a nother table, it returns it in the query. Does any one know of a way to return ONLY the Primary Key of a table and nothing else? Thanks
  11. Im not familiar with fusionchart, but if you are wanting to write the contents of the query result to an XML file, you can use the XMLwriter classes, but i prefer for smaller xml files to just output a file formatted as XML as though i were making a text. <?php $xml = "<?xml version = '1.0' encoding = 'UTF-8'?>\n"; $xml .= "<container>\n"; $xml .= "\t<parent name=\"some value\">\n"; $xml .= "\t\t<child variable=\"some value\">\n"; $xml .= "\t\t<child variable=\"some value\">\n"; $xml .= "\t</parent>\n"; $xml .= "\t<parent name=\"some value\">\n"; $xml .= "\t\t<child variable=\"some value\">\n"; $xml .= "\t\t<child variable=\"some value\">\n"; $xml .= "\t</parent>\n"; $xml .= "</container>\n"; $openFileToWrite = fopen("myXML.xml", "w"); fwrite ($openFileToWrite, $xml); fclose ($openFileToWrite); ?> Very quick and very dirty, but it works. If your xml files are going to be quite big or you are using this sort of thing a lot, you should consider looking into the appropriate classes designed for writing xml files as this method can quickly become a pain to deal with.
  12. Sorry, i completely missed that. Have you tried using an inner join?
  13. andy_b42

    Unlink

    Why is there a "/" after the filename? That will cause the machine to read dargil.pt as a folder and not a file.
  14. When you do your join, you need to say on what field the tables join. So your join will be something like: SELECT o.oHOUSE,o.oWILL,o.oRENTED,o.oIMAGE,o.oUPGRADES,o.oID,o.oOWNER FROM `house_owned` `o` LEFT JOIN `house_rentals` `r` on r.rOWNER = o.OWNER I am not fully sure i understand what you are trying to achieve, but really you should specify how the tables are linked in a join.
  15. Are oOWNER and rOWNER equivalent fields?
  16. andy_b42

    Unlink

    Only other thing i can think of then if you have 777 permissions on that folder and file would be that the directory is correct. Have you tried using getcwd() to check you are in the right place?
  17. andy_b42

    Unlink

    Having access rights to create files doesn't neccesarily mean you will be able to delete them.
  18. Are you getting any errors when it is running live?
  19. if ($_SESSION['link'] >0){ $sess = $_SESSION['link']; }else{ $sess = "0"; } try that... you had a ";" after the if statement
  20. You should be able to do this by terminating each query with a ";" eg $query = " UPDATE secondary_table SET amount = '$newsec_amt' WHERE membersemail = '$recipient'; UPDATE primary_table SET amount = '$newsender_amt' WHERE membersemail = '$sender';"; mysql_query($query); This will execute both queries. If what you want to do is join both queries into a single string, you can do this, but i would recommend against it because it will confuse things quite significantly. You would need to specify which table each field is on (primary_table.field etc) and you would still have to specify that you were changing each individual field on each table. You can't do something like: "update table1, table2 set field1 = 'value' where table1.field2 = x and table2.field = y" because the sql server wont know which tables you are referring to.
  21. Actually, looking through your script, it looks very similar to mine, try changing the line: //Header ("Content-type: $image"); for this header("Content-type: image/jpeg");
  22. I made this file to return an image from a database (i use this with an mssql database, so ive just chagned the commands from mssql_ to mysql_, i think it should work the same. Just amend the query and connection string for your own settings and it should work <?php session_start(); if($_SESSION['loggedIn']){ require("settings.php"); $imageID = $_GET['imageID']; $connection = mysql_connect($server, $username, $password) or die ("Unable to connect to server"); $db = mysql_select_db($database, $connection) or die ("Unable to select database"); $sqlString1 = "SELECT image FROM images WHERE imageID = $imageID"; $sqlResult1 = mysql_query($sqlString1, $connection) or die ("Unable to run query. Error ID 1!"); $row = mysql_fetch_assoc($sqlResult1); $imagebytes = $row['image']; header("Content-type: image/jpeg"); print $imagebytes; } ?>
  23. This line: GetSQLValueString($_SESSION['MM_Username'], "text") calls a function (GetSQLValueString), but i can't see it being defined anywhere in your code below, it may be in one of your included files, but the error you are getting suggests that you have not made that function visible to the page in your second piece of code
  24. alin19, A few things i would check would be that your setup accepts <? instead of <?php (i doubt this would make any difference but i would check anyway) Next, i would check that HTTP_SERVER_BASE ends with a "/".
  25. i think the problem might be that spaces are no recognised url characters, try adding this line: $imagename = str_replace(" ", "%20", $imagename); before list($width, $height, $type, $attr) = getimagesize(addslashes($imagename)); this will replace spaces with %20which is the url character for a space
×
×
  • 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.