PHP - Simple Link Problem !!
Hi, This is a image tooltip from database. but I have got the problem, Not Working!
How can i fix it. <a href="index.php?MD=urundetay&resimid=<?php echo $row_uruns['resimid']; ?>"><img src="urun_resim/<?php echo $row_image['image']; ?>" width="150" border="0" /></a> Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=308937.0 It shouldn't be that difficult I just don't know how to do it myself. I'm using the following code for a simple navigation, i has been placed in the content of my home page, it works fine however i don't know how to set the home page. <div id="content"> <?php $page = $_GET['page']; $file = $page.".php"; if(file_exists($file)) { include($file); } else { include "error.php"; } ?> </div> so I have an xml string the following expression $xpath = $response->xpath('/atom:feed/atom:entry/atom:content'); returns the following array SimpleXMLElement Object ( [@attributes] => Array ( [type] => application/vnd.google-earth.kml+xml ) [Placemark] => SimpleXMLElement Object ( [name] => M1 [description] => SimpleXMLElement Object ( ) [Style] => SimpleXMLElement Object ( [IconStyle] => SimpleXMLElement Object ( [Icon] => SimpleXMLElement Object ( [href] => http://maps.gstatic.com/intl/en_ALL/mapfiles/ms/micons/blue-dot.png ) ) ) [Point] => SimpleXMLElement Object ( [coordinates] => -79.395018,43.645423,0.0 ) ) ) However what I'm trying to get are the coordinates, but neither $xpath = $response->xpath('/atom:feed/atom:entry/atom:content/Placemark'); OR $xpath = $response->xpath('/atom:feed/atom:entry/atom:content/Placemark/child::*'); work I even tried just loading atom:content into an array and going from there no luck. Any ideas. Oh. BTW this might help http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_protocol.html#RetrievingFeatures SOLVED, sorry. ... but i can't work it out. all i want to do is; if ( $this_item exists within the table ) { do a } else { do b } for example, $this_item = 'john', and i want the script to do (a) if he's in the table, or (b) if he isn't. thank you! This is my website: www.wearenip.com/home.html This is the menu that should appear on the left hand side, but doesn't: www.wearenip.com/menu.php This is my server's output saying that php is running just fine: http://wearenip.com/phpinfo.php I'm using this code in the left side bar div: Code: [Select] <?php include("menu.php"); ?> The PHP file will not display from the HTML file no matter what I do. I've tried using every possible combination of file linking including /menu.php ./menu.php and even the full http://www.wearenip.com/menu.php etc etc etc I'm genuinely upset about this. Any help would be greatly appreciated. PS: I can't get any PHP file to properly include in any HTML file on any computer I have. Nothing displays whatsoever regardless of what is in the PHP file, even if it's just a text word. Doesn't matter if it's hosted on a PHP compatible internet server or just on a local server or just on the local machine itself. Nothing. I'm having a problem with make my links work. I have a link saved in a session variable but when I print it to the screen it doesn't seem to work. What happens is instead of the link taking you to "www.google.com" it will but the currently directory first so for example if would be "www.example.com/folder/www.google.com". I have checked the page source and it appears to be fine so I'm not sure what's happening. I've copied my code below. echo("<h3 class=\"left\"><a href=\"" . $_SESSION['submit_content_link'] . "\" class=\"linker\" title=\"1\" target=\"_blank\">" . $_SESSION['submit_content_title'] . "</a></h3>"); Thanks for any help. if i put a link in to go to google say, <a href='www.google.com'>link1</a> it goes to www.mysite.co.uk/www.google.com can any1 help? cheers mat I'm having a problem with including a list of clickable links. They keep including my website address before the web address instead of the the web address alone. Here is the code I'm using for it. The $item_url is the web address from the database. $content .="<table width=\"700\" height=\"50\" border=\"0\"><tr><td width=\"500\" class=\"titles\"><a href=$item_url target=\"_blank\">$item_title</a></td></tr><tr> <td width=\"400\" class=blackfont>Location: {$item_city}, {$item_state}</td></tr><tr><td class=blackfont>Country: {$item_country}</td></tr><br /> </table>"; hi guys usename:password user1:pass1 user2:pass2 user3:pass2 i have a function fun(username,pass) and i want to run it for lots of different user names and passwords. what would the best way to do this? would i make an array and use a foreach loop or how would i do it and what could would i need?? I am thining this will be pretty simple for someone to help me with, I have been hassling with it for several hours and really feel dumb that I can't get it to work. Here is the problem - I have one script wherein I have a form that passes a variable using Post method. I have previously assigned a value "A" to a variable $rtn the input is: <input name="Rtn" type="hidden" value="<?php echo $rtn; ?> /> In the script that I am calling I first get the value of the variable: $rtn = (_POST['Rtn']); then there is other stuff goin on and I come to an if stmt: if ($rtn == "A" { do some stuff } else { echo $rtn; } It will never get into the do some stuff - it always falls through to the else the output is \'A\' I have tried to use double quotes, single quotes, used stripslasches and addslashes funtions, trim, and various combination of all of these. Nothing I do seem to get me into the first part of the if stmt, to do some stuff. I have a script.. it works fine on my localhost.. now i am trying to work it with on my remote server.. the script reads the folder in my c drive and shows me the file on display here is the code <?php $main_dir ="C:\\xampp\\htdocs\\xtrajam"; $main_open = opendir($main_dir); while(($main_file = readdir($main_open)) != FALSE) { echo $main_file."<br />"; } closedir($main_open); ?> Now the thing is this works fine on local host as it can easy access the path C:\\xampp\\htdocs\\xtrajam Now i want this path to be accessed sumhow wen i try it on my remote server.. how should i do that like when i run the script online it reads the contents from my c drive directory..? is it sumhow possible? Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\parkhall\quantities.php on line 21 This is the error message. This is the code. simple array query to display contents of table and I cant see where i have made the mistake. hopefully someone can help. <?php mysql_connect ("localhost", "******", "*****") or die ('I cannot connect to the database becuase: ' . mysql_error()); mysql_select_db ("matquant"); $query = mysql_query("SELECT * FROM quantities"); while ($row = mysql_fetch_array($query)) { //line referred to in error message echo "<br /> ID: " .$row ['id']. " material : " .$row ['material']. "quantity:" .$row['quantity']. "<br />";} ?> Please point out the probably glaring error. I'm relatively new to this and I am really not finding php easy to learn. Sorry this page is not available or has been accessed in error An error occurred in script 'C:\xampp\htdocs\public_html\login\plugins\delete_product.php' on line 45: Undefined variable: id Date/Time: 8-24-2010 00:50:10 Array ( [GLOBALS] => Array *RECURSION* [_POST] => Array ( ) [_GET] => Array ( [id] => 2 ) <?php # Script 9.2 - delete_product.php // This page is for deleting a album. require_once ('../includes/config.inc.php'); // Check for a valid product ID, through GET or POST: if ( (isset($id)) && (is_numeric($id)) ) { // From editproducts.php $id = $_GET['id']; } elseif ( (isset($_POST['id'])) && (is_numeric($_POST['id'])) ) { // Form submission. $id = $_POST['id']; } else { echo '<p class="error">Sorry this page is not available or has been accessed in error</p>'; } echo $id; require_once(MYSQL); // Check if the form has been submitted: if (isset($_POST['submitted'])) { if ($_POST['sure'] == 'Yes') { // Delete the record. // Make the query: $q = "DELETE FROM products WHERE product_id='$id' LIMIT 1"; $r = @mysqli_query ($dbc, $q); if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. // Print a message: echo '<p>The Product has been deleted.</p>'; } else { // If the query did not run OK. echo '<p class="error">The Product could not be deleted due to a system error.</p>'; // Public message. echo '<p>' . mysqli_error($dbc) . '<br />Query: ' . $q . '</p>'; // Debugging message. } // Make the query: $q = "DELETE FROM photos WHERE product_id='$id'"; $r = @mysqli_query ($dbc, $q); } else { // No confirmation of deletion. echo '<p>The Product has NOT been deleted.</p>'; } } else { // Show the form. // Retrieve the albums information: $q = "SELECT name FROM products WHERE product_id='$id' Limit 1"; $r = @mysqli_query ($dbc, $q); if (mysqli_num_rows($r) == 1) { // Valid user ID, show the form. // Get the user's information: $row = mysqli_fetch_array ($r, MYSQLI_NUM); $form = $_SERVER['PHP_SELF']; // Create the form: echo '<form action="' . $form . '" method="post"> <h1>Delete ' . $row[0] . '?</h1> <p>Are you sure you want to delete ' . $row[0] . '?<br /> <p><b>Warning if you delete this album all content inside of it will be losed!</b><br /> <input type="radio" name="sure" value="Yes" /> Yes <input type="radio" name="sure" value="No" checked="checked" /> No</p> <p><input type="submit" name="submit" value="Submit" /></p> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="id" value="' . $id . '" /> </form>'; } } mysqli_close($dbc); ?> Hi -- This query seems to be problematic because the UPDATE is not being performed. Could you please take a gander and let me know what is the problem? BTW, the table "teamy" does contain 630 records. Thanks in advance! $sql = "SELECT COUNT( * ) AS records FROM teamy" ; $result = mysql_query( $sql ) ; if ( ! $result ) { die ( __line__ . "_teamy_" . mysql_error() ) ; } $a_count = mysql_fetch_assoc($result); if ( $a_count['records'] = 0 ) { echo "No records found in teamy." ; } else { /*** Update r_rost_rma ***/ $sql = "UPDATE r_rost_rma JOIN teamy ON r_rost_rma.student_id = teamy.student_id SET r_rost_rma.teachername = teamy.team WHERE RTRIM( UPPER( r_rost_rma.localcourse ) ) = 'HOMEROOM'" ; $result = mysql_query ( $sql ) ; if ( ! $result ) { die ( __line__ . "_update_r_rost_rma_" . mysql_error() ) ; } } Hi guys,
I am trying to echo multiple calendar events from a mysql table and order them by the date column.
There are several events on each day so I am trying to echo the date once then list the associated events under that date.
Such as
2014-05-10
Event 1, event 2, event 3
2014-05-11
Event 1, event 2, event 3
instead of
2014-05-10 event 1,
2014-05-10 event 2,
2014-05-10 event 3,
2014-05-11 event 1 etc...
This is my coding so far:
while($row = mysqli_fetch_assoc($result)) { $dutydate = $row['MyDate']; if($dutydate != $previousdate) { echo $dutydate.'<br />'; } elseif(!empty($dutydate)) { echo $dutydate.'<br />'; } echo $event1.' | '.$event2.' | '.$event3.'<br />'; $previousdate = $dutydate; } ?> Ok I got this column "date_reg" on my table which has a "datetime" type. It's giving me a value like "2012-04-20 04:28:03" The problem is, when I'm trying to insert on that column using this format Code: [Select] <?php $datenow = date('m/d/Y h:i:s a', time()); ?> it's giving me a value of "0000-00-00 00:00:00" which is suppose to be the current date and time the user add on that table. Anyone knows how I can fix this? i am running a file in the following folder on my hosting server /httpdocs/folder1/folder2/script.pjp how do i include a file that is located at the root of the hosting server /httpdocs/globalFunctions.php iv tried $maindir = dirname(__FILE__) . DIRECTORY_SEPARATOR; require $maindir . DIRECTORY_SEPARATOR . "globalFunctions.php"; include('http://www.domainname.com/globalFunctions.php'); and include('../../globalFunctions.php'); but none of these work any ideas Hello, i am trying to create a simple funtion that i can all upon to "turn off a website" i am calling the function by <?php siteonline(n); ?> and the function is function siteonline($msg){ $offlinecheck = mysql_query("SELECT * FROM acp") or die(mysql_error()); $siteoffline = mysql_fetch_array($offlinecheck); $ifsiteoffline = $siteoffline['site_offline']; $offline = $siteoffline['offline_msg']; if ($ifsiteoffline == "y") { echo("$offline"); die();} } now this will turn off the site but it shows no message what so ever and i can not figure out why can anyone help? Cheers, So, I'm going through a tutorial in my PHP book and we're using the code below. The page shows up and connects to the database (no error reported), but no data comes up. I'm wondering if I'm just missing something small or what? Let me know if you can help <html> <head> <title>Search Results</title> </head> <body> <h1>Book-0-Rama Search Results</h1> <?php //create short variable names $searchType=$_POST['searchType']; $searchTerm=trim($_POST['searchTerm']); if(!$searchType || !$searchTerm){ echo 'You have not entered enough information to process the search'; exit; } if(!get_magic_quotes_gpc()){ $searchType = addslashes($searchType); $searchTerm = addslashes($searchTerm); } echo $searchType; echo $searchTerm; @ $db = new mysqli('localhost','root','root'); if(mysqli_connect_errno()){ echo 'Error: Could not connect to the database man...'; exit; } $query = "SELECT * FROM books WHERE ".$searchType." LIKE '%".searchTerm."%'"; $result = mysqli_query($query); $num_results = mysqli_num_rows($result); echo "<p>Number of books found: ".$num_results."</p>"; for ($i=0;$i<$num_results;$i++){ $row = mysqli_fetch_assoc($result); echo "<p><strong>".($i+1).". Title: "; echo htmlspecialchars(stripslashes($row['title'])); echo "</strong><br/>Author: "; echo stripslashes($row['author']); echo "<br/>ISBN: "; echo stripslashes($row['isbn']); echo "<br/>Price: "; echo stripslashes($row['price']); echo "</p>"; } $result->free(); $db->close(); ?> </body> </html> Hello, I have a simple issue with a code that uses includes. What I want to do is to include a bit of php code I made to my main pages so I don't have to edit each file that will contain the same included code. The problem with that included code is that contains variables that only the main files would know. Let me show you basically what I'm talking about. mainfile1.php Code: [Select] <?php $cat = "meow"; include "content.php"; ?> mainfile2.php Code: [Select] <?php $cat = "mew"; include "content.php"; ?> (mainfile3.php and so on...) content.php Code: [Select] echo '<center>My cat said '.$cat.' today!</center>'; I was expecting to see: My cat said meow today! and My cat said mew today! But when I loaded both pages it rendered like this: My cat said '.$cat.' today! HTML works properly but the variables are ignored and displayed as plain text. What I need to do so those variables don't get ignored? Thanks. |