PHP - Trouble With Missing Data When Grabbing From A Txt File
Hey guys,
I have a script that grabs data from a separate .txt file which is used to perform certain actions within a user's account. The data I'm having trouble with is user key which is used to authenticate an http header. An example of what the txt file would hold is this: 360235276 PbI1c5+PGHSshccYd58AklmTgf5u+tbWZplMRYYxFSivRYw4AZhaVNHwADozYZhZhPnXRSV1rmsrhf1td7w6bJbySZmPHLl+hleyz/Ht4iM= 477947328 cXTnFEVP74RWtAgqM5BlwtgW2i9rP/v44oANzwF+yJZ+9mpvaschyo/HaYP1qUXgIK8nK7jy74iSCEHAgpPgPdryzpReM5cbnVDjRw7h9S0= 503724987 XXEJsklZTFaTx8MLjuNIz0S65Sn02rgbHl2sahdReQdadKP39 evIXUoYdr5NyQMWDVE7cRpvn+zJ7mteH7WJzVh0U/sOcSG7kfcuaWpAOfo= The format I have is: account_ID user_key New account on a fresh line. So in my script I have it grabbing the data as so: $User_DataFile = "accountdata.txt"; $AccData = file($User_DataFile, FILE_SKIP_EMPTY_LINES); foreach($AccData as $line_num => $line) { $AccData = explode(" ", htmlspecialchars(str_replace(" "," ",$line))); if(stristr($AccData[1], "\n")) $AccData[1] = substr($AccData[1], 0, strlen($AccData[1])-2); $AccountID = $AccData[0]; $UserKey = $AccData[1]; echo "Account ID: ".$AccountID."<br/>User Key: ".$UserKey."<br/><br/>"; I have it set to simply echo out the data for debugging which is where I noticed that any slashes or plus or equal signs were not included. When run in Apache it returns this: Account ID: 360235276 User Key: PbI1c5+PGHSshccYd58AklmTgf5u+tbWZplMRYYxFSivRYw4AZhaVNHwADozYZhZhPnXRSV1rmsrhf1td7w6bJbySZmPHLl+hleyz/Ht4iM Account ID: 477947328 User Key: cXTnFEVP74RWtAgqM5BlwtgW2i9rP/v44oANzwF+yJZ+9mpvaschyo/HaYP1qUXgIK8nK7jy74iSCEHAgpPgPdryzpReM5cbnVDjRw7h9S0 Account ID: 503724987 User Key: XXEJsklZTFaTx8MLjuNIz0S65Sn02rgbHl2sahdReQdadKP39 evIXUoYdr5NyQMWDVE7cRpvn+zJ7mteH7WJzVh0U/sOcSG7kfcuaWpAOfo So as you can see by comparison there is no slashes or plus or equal signs present, which is going to be a major problem. Is there any way of getting around this problem? Thanks. Similar TutorialsI'm new to the PHP world and trying to work my way through a problem. I've gone down many roads, but can't seem to find the answer. I'm not even sure this is so much a PHP question at this point as a host configuration issue. I'm trying to grab an XML file from a remote server. My first try was to try to shell out a wget as follows: exec("wget -q -O status.xml - http://$username:$password@$hostname:$port/cgi-bin/status.xml",$xmlget,$err); This didn't work. Not a surprise since doing it directly from SSH gave: Connecting to mydomain.com|99.99.99.99|:8080... failed: Connection refused. [Note that the port 8080 above is, I think, key] I've since tried method using both file_get_contents and cURL. Similar results for all. I won't clutter this up with the code unless you ask. It's all very straightforward. [file_get_contents complains 'Connection refused' and curl_error says 'couldn't connect to host']. With all of the methods, I'm able to grab, say, google.com AND a page from mydomain.com (default port 80), just not from port 8080. I've set 'allow_url_fopen = on' in php.ini and in my code for good measure. Also, the XML file that lives at 8080 is retrieved fine through a browser. I'm hosted at GoDaddy on their "deluxe shared linux" plan. Is there something obvious I'm missing that would allow all this to work over port 80, but not 8080? Thanks is advance! Greg Currently I am using this very popular code to get all the football scores: Code: [Select] $title = $params->get('title'); $fontc = $params->get('fontc'); $fonts = $params->get('fonts'); //this array contains sports and their URLs $sports = array( "NFL" => "http://sports.espn.go.com/nfl/bottomline/scores"); $results = array(); foreach ( $sports as $sport => $url ) { //get the page pointed to by $url $page = file_get_contents($url); //grab all variables out of the page preg_match_all("/&([^=]+)=([^&]+)/", urldecode($page), $foo); //loop through all the variables on the page foreach ( $foo[1] as $key => $value ) { //debug output, you can delete this next line //echo "{$value} = {$foo[2][$key]}\t<br />\n"; //this chain of IF/elseif statements is used to determine which pattern to use //to strip out the correct data, since each sport seems to have its own format //for the variables you'd "want" if ( $sport == "NFL" && preg_match("/s_left\d+/", $value) ) { $results[$sport][] = $foo[2][$key]; } } } //calculate the sport with the most number of rows $limit = 0; foreach ( $results as $countMe ) { $limit = max($limit, count($countMe)); } //spit out the table with the right headers echo "<td><b> $title </b></td><br><BR>"; "<table border=4 cellpadding=10><tr><th>" . implode("</th><th>", array_keys($sports)). "</th></tr>" ; //loop until you reach the max number of rows, printing out all the table rows you want for ( $p = 0; $p < $limit; $p++ ) { foreach ( array_keys($sports) as $sport );{ $change = str_replace('^','<font color=green><b>W</b> </font>' ,$results[$sport][$p]); $final = str_replace('(FINAL)','<font color=red>(FINAL)', $change); echo "<td><font color=$fonts size=$fontc><b>$final</b></font></td><br>"; } echo "</tr>"; } //kill the table echo "</table>"; and it works fantastically well however.... I'd only like to get certain data say like the Cowboys game info and nothing more... NOT too sure how to do this, I'm just not really sure how to read the page, grab only that data. Help would be greatly appreciated! Thank you. Hi guys...
I was at home and doing some coding and stumbled across and API for a computer game called Battlefield 4
http://api.bf4stats....ApRiL&output=js;
I was checking it out and it is a LOT of data. I was wondering if its possible to only pull certain data from the API, say for instance you only want to pull your user name, ID, and what game you are playing (those are the top 3 things). How would you pull only those 3 stats and display that information on say a webpage for you?
thanks guys
JL
Hi, Im trying to grab some data from a XML generated by an external server. I know how to grab from XML without attributes, but I cant seem to wrap my head around the structure of this file. What would be easiest way to get the value of the "dbnr" field? Part of the XML file: Code: [Select] <data> <location> <field name="id" format="Long">xxxxxx</field> <field name="dbnr" format="Long">xxxxxx</field> <field name="jobnr" format="Long">xxxxxx</field> <field name="job_type" format="String" maxlen="50">xxxxxx</field> <field name="job_category" format="String" maxlen="50">xxxxxx</field> </location> </data> So I'm trying to grab values from a specific table id in html in PHP possibly using `DOMElement` or something else? I want to add my index.php page to a variable, search for a certain table id ( in this case, "shades" ), then grab JUST the values from inside that table & print it out in an echo. Here's what i have. for some reason I'm getting Warning: DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity <?php $HTML = [ ]; $stream = fopen ( "index.php", "r" ); $string = stream_get_contents ( $stream ); HTML [ 0 ] = $string; // Our HTML goes here $innerHTML = implode ( ',', $HTML ); // Create a new DOMDocument based on our HTML $document = new DOMDocument; $document -> loadHTML ( $innerHTML ); // Get a NodeList of any table "id", "shades" $cells = $document -> getElementsByTagName ( "id" ); // Cycle over each <td>, adding its HTML to $innerHTML foreach ( $cells as $cell ) { $innerHTML = $document -> saveHTML ( $cell ); } // Output our glorious HTML echo $innerHTML; fclose ( $stream ); ?>
This is a sample html code i have to work with: Code: [Select] <div class="spaceit_pad"><span class="dark_text">English:</span> Fullmetal Alchemist: Brotherhood</div><div class="spaceit_pad"><span class="dark_text">Synonyms:</span> Hagane no Renkinjutsushi (2009), Fullmetal Alchemist (2009), FMA</div><div class="spaceit_pad"><span class="dark_text">Japanese:</span> 鋼の錬金術師</div> I want to extract Specifically these lines: 1) Code: [Select] Fullmetal Alchemist: Brotherhood2) Code: [Select] Hagane no Renkinjutsushi (2009), Fullmetal Alchemist (2009), FMA3) Code: [Select] 鋼の錬金術師 from that, and all this is loaded from a thrid party website, like wikipedia. please help? This question is part PHP, part MySQL. I have a survey_responses table...
- id - survey_id - question_id - member_id - response
For satisfaction questions (i.e. 1 = Strongly Disagree, 2 = Disagree, 3 = Neither, 4 = Agree, 5 = Strongly Agree), I'm trying to figure out how to get the counts for each of those responses into PHP so I can then feed them to a Bar Chart I hope to create with HTML/CSS. 1.) Should I create some kind of loop in PHP, and look for each value (e.g. 1 = Strongly Disagree) and one at a time plug them into variables called: $stronglyDisagree, $disagree, $neighter, $agree, $stronglyAgree?
2.) Or do I first need a "cross-tab" query in MySQL?
3.) Would this be easier if the database values were in a PHP array?
Not sure where to begin with this, and more importantly, I want to make sure that my data model in MySQL is sufficient so i can do reporting like this!!
Thanks.
hello this form is not submitting all the 'jeweltype' data to the mysql db. help please ============================================= html> <head> <title>Upload an image to a database</title> </head> <body> <table> <form name="Picture" enctype="multipart/form-data" method="post"> <tr> <td>Upload <input type="file" name="imagefile"><br /> Jewelery Type: <select> <?php $sql="SELECT jeweltype FROM jeweltypes"; $result =mysql_query($sql); while ($data=mysql_fetch_assoc($result)) { ?> <option value="jeweltype"><?php echo $data['jeweltype'] ?></option> <?php } ?> </select> <br /> <input type="submit" name="xsubmit" value="Upload"> </td> </tr> <tr> <td>Latest Image</td> </tr> <tr> <td><img src="?pic=1"></td> </tr> </form> </table> </body> </html> ========================================== with this query ========================================== <html> <head><title>Your Page Title</title></head> <body> <?php include ('connect.php'); @mysql_select_db($database) or die( "Unable to select database"); $result = mysql_query( "SELECT jeweltype FROM jewel_images" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print "<table width=400 border=1>\n"; while ($get_info = mysql_fetch_row($result)){ print "<tr>\n"; foreach ($get_info as $field) print "\t<td><font face=arial size=1/>$field</font></td>\n"; print "</tr>\n"; } print "</table>\n"; ?> </body> </html> i am trying to pull a .txt file for a class assignment and it is pulling everything except for line 1 any suggestions would be great html: <html> <head> <title>Weekly Report</title> <link rel ="stylesheet" type="text/css" href="sample.css" /> </head> <body> <h1>Weekly Report</h1> <p> <form action = "weeklyReport1Boles.php" method = "post" > <p> <input type = "submit" value = "Display the Report" /> </p> </form> </body> </html> txt.file 1 236.00 2 284.00 3 148.00 4 128.00 5 0.00 6 110.00 7 0.00 8 php file: <?php $total = $_POST['total']; $avgDailyIncome = $_POST['avgDailyIncome']; $badDays = $_POST ['badDays']; $paintFile = $_POST ['paintfile']; $nextDay = $_POST['nextDay']; $paintFile = fopen("weeklyDataBoles.txt","r"); $week = fgets($paintFile); $total = 0; for ($count = 1; $count <=8; $count = $count +1) { $nextDay = fgets($paintFile); $total = $total + $nextDay; } $avgDailyIncome = $total/7; print("<p>TOTAL INCOME FROM PAINT CONTRACTS: "); print("$".number_format($total, 2)."</p>"); print("<p>AVG DAILY INCOME FROM PAINT CONTRACTS: "); print("$".number_format($avgDailyIncome, 2)."</p>"); print("<p>NUMBER OF DAYS with NO INCOME: $badDays.</p>"); ?> </body> </html> When I upload new files, their file name is stored into my database. I have been told that a couple of the file downloads weren't working. Upon further investigation I figured out that the file the person wanted to download was nowhere to be seen in my downloads directory. How can I determine if a file exists in my directory? I assume I can somehow use the location that is stored inside my database (ex: myfile.pdf) and compare that with what's in the folder. Ok...working with serialized data is not fun. This is how WordPress does it. I had something working a little, but it wasn't getting all the information I needed. The query below appears to retrieve all the information I need. What I'm trying to do is determine what type of Subscription (s2member_level) a User gets and where they live (county). I eventually want to show the total number of each group, as well as the Usernames (only 18 total right now). The below code SHOULD look like this: Region 1: ## members Region 2: ## members Region 3: ## members Region 4: ## members Region 5: ## members But...right now it just shows Region : 18 members (no number after the region) Code: [Select] $custom = 'SELECT * FROM wp_usermeta um1 INNER JOIN wp_usermeta um2 JOIN wp_users u ON um1.user_id=um2.user_id WHERE um1.meta_key = "wp_s2member_custom_fields" AND um2.meta_value LIKE "%s2member_level%" AND um1.user_id = u.ID GROUP BY um1.user_id'; $c_results = mysql_query($custom); $region = array(); while($line = mysql_fetch_assoc($c_results)) { $meta_value = unserialize($line['um1.meta_value']); $region[$meta_value['county']]++; }; foreach ($region as $key => $value) { echo "Region $key: $value members<br>"; } This is just a sample of the data retrieved for four Users. I used the Inner Join through help on here. Each row shows two entries from the same table. The code above appears to be counting the valid results properly, but it's not dividing them up. So it appears to work down to the "foreach" part. Quote umeta_id user_id meta_key meta_value umeta_id user_id meta_key meta_value 15624 1073 wp_s2member_custom_fields a:1:{s:6:"county";s:1:"1";} 15617 1073 wp_capabilities a:1:{s:15:"s2member_level2";s:1:"1";} 16041 1094 wp_s2member_custom_fields a:1:{s:6:"county";s:1:"3";} 16034 1094 wp_capabilities a:1:{s:15:"s2member_level2";s:1:"1";} 16491 1117 wp_s2member_custom_fields a:1:{s:6:"county";s:1:"2";} 16484 1117 wp_capabilities a:1:{s:15:"s2member_level2";s:1:"1";} 16671 1126 wp_s2member_custom_fields a:1:{s:6:"county";s:1:"3";} 16664 1126 wp_capabilities a:1:{s:15:"s2member_level2";s:1:"1";} Hello, I'm having trouble inserting data into a MySQL table. The user has a form which is HEIGHT and WIDTH and NUMBER_OF_OBSERVATIONS. All these values are stored in the same table. NUMBER_OF_OBSERVATIONS does what it needs to and inserts its calculated results into the database, as does DATE_TIME. I've been trying for a couple of days to get this done, and I am having no luck in getting it sorted. Any help is greatly appreciated! Generator.php Code: [Select] $WIDTH = $_POST['WIDTH']; $HEIGHT = $_POST['HEIGHT']; $NUMBER_OF_OBSERVATIONS = $_POST['NUMBER_OF_OBSERVATIONS']; $db1 = new Number_Information(); $db1->openDB(); $OBSERVATION_ID = $db1->insert_Observation(); echo "<br /><br />Success. ID: <strong>$OBSERVATION_ID<strong>"; $db1->closeDB(); Number_Information.php Code: [Select] function insert_Observation() { //$Date_Now = datetime(); $sql = "INSERT INTO Observations (DATE_TIME, HEIGHT, WIDTH) VALUES (NOW(), '{$esc_HEIGHT}','{$esc_WIDTH}' )"; $result = mysql_query($sql, $this->conn); if (!$result) { die("SQL Insertion error: " . mysql_error()); } else { return mysql_insert_id($this->conn); } The table name is Observations Again - Any help is greatly appreciated! Hi i'm new to PHP/web development but not new to coding. I have some php code that I grabed from a template where I am selecting data from a file and having it diplay on the screen in a form. My $query = "select * from file where" statement works and bring the data back to the screen. However, I want the data to be returned in a textarea instead of a text field that is not big enough to display the 3 paragraph that i need to display. Please see code below, thsi code will return the data but the text box only returns the data in a line, I need the data to be returned in a textarea, so I can update it. I have looked for the correct syntex with no luck, please correct me. $row = mysql_fetch_array($result, MYSQL_ASSOC); $recordid = $row['recordid']; $homepage = $row['homepage']; echo "<h2>Update About Us Information</h2>\n"; echo "<form enctype=\"multipart/form-data\" action=\"admin.php\" method=\"post\">\n"; echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td><h3>Record ID</h3></td><td>$recordid</td></tr>\n"; echo "<tr><td><h3>Homepage</h3></td><td><input type=\"text\" size=\"100\" name=\"homepage\" value=\"$homepage\" /></td></tr>\n"; echo "</table>\n"; echo "<input type=\"submit\" name=\"button\" value=\"Update\">\n"; echo "<input type=\"submit\" name=\"button\" value=\"Delete Product\">\n"; echo "</form>\n"; Hey, Having some troubles extracting data from simpleXML object. var_dump outputs all the stuff correctly but when i try access data in the object, it just comes back empty. $rss = "/data/rss/"; $rss = file_get_contents($rss); // simplexml_load_file() fails $feed = new SimpleXMLElement($rss); foreach($feed->item as $news) { echo $news->title; // returns empty } echo $feed->item->title; // also is empty so var_dump($feed) outputs this, shortened version: object(SimpleXMLElement)#10 (2) { ["@attributes"]=> array(1) { ["version"]=> string(3) "2.0" } ["channel"]=> object(SimpleXMLElement)#11 (6) { ["title"]=> string(38) "Bradford Bulls Super League Rugby News" ["description"]=> string(75) "RSS Feed for the latest Bradford Bulls Super League rugby news and updates." ["link"]=> string(46) "http://www.superleaguefans.com/bradford-bulls/" ["language"]=> string(2) "en" ["pubDate"]=> string(26) "Sat, 03 Sep 13:42:39 +0100" ["item"]=> array(10){ [0]=> object(SimpleXMLElement)#12 (1) { ["title"]=> string(32) "Briggs and Walker in Bulls squad" } } } } so, $feed->item->title should return the ["title"] contents, but it doesn't, driving me crazy. what am i doing wrong? Any pointers will be much appreciated, thank you. I'm having trouble listing the most recent 10 content. How can I solve this problem. $sorgu = mysqli_query("select * from icerik order by id desc limit 0,10");
while($goster=mysqli_fetch_assoc($sorgu)) { } error code: Fatal error: Uncaught ArgumentCountError: mysqli_query() expects at least 2 arguments, 1 given in C:\xampp\htdocs\blog\orta.php:3 Stack trace: #0 C:\xampp\htdocs\blog\orta.php(3): mysqli_query('select * from i...') #1 C:\xampp\htdocs\blog\index.php(4): include('C:\\xampp\\htdocs...') #2 {main} thrown in C:\xampp\htdocs\blog\orta.php on line 3 Hi: I am working with a PHP Event Calendar. I am having trouble displaying the data the way I want to. If a person clicks on a number/date in the calendar (17, for example) the data will display fine below the calendar.\ However, I want to display only the Event Title ("calName") in the date box as a link, and allow the user to click the title to go to a new page to see the full Event info. I can not get any of the data to display and hope someone can tell me what I'm doing wrong. This is the code: Code: [Select] <script> function goLastMonth(month, year){ // If the month is January, decrement the year if(month == 1){ --year; month = 13; } document.location.href = '<?=$_SERVER['PHP_SELF'];?>?month='+(month-1)+'&year='+year; } //next function function goNextMonth(month, year){ // If the month is December, increment the year if(month == 12){ ++year; month = 0; } document.location.href = '<?=$_SERVER['PHP_SELF'];?>?month='+(month+1)+'&year='+year; } function remChars(txtControl, txtCount, intMaxLength) { if(txtControl.value.length > intMaxLength) txtControl.value = txtControl.value.substring(0, (intMaxLength-1)); else txtCount.value = intMaxLength - txtControl.value.length; } function checkFilled() { var filled = 0 var x = document.form1.calName.value; //x = x.replace(/^\s+/,""); // strip leading spaces if (x.length > 0) {filled ++} var y = document.form1.calDesc.value; //y = y.replace(/^s+/,""); // strip leading spaces if (y.length > 0) {filled ++} if (filled == 2) { document.getElementById("Submit").disabled = false; } else {document.getElementById("Submit").disabled = true} // in case a field is filled then erased } </script> ............... <p> <div id="legend"> <img src="images/Cal-Icon.jpg" style="padding: 0 15px 15px 0;" /> Today is: <? $today = date("F j, Y, g:i a"); echo " $today " ?> </div> <?php //$todaysDate = date("n/j/Y"); //echo $todaysDate; // Get values from query string $day = (isset($_GET["day"])) ? $_GET['day'] : ""; $month = (isset($_GET["month"])) ? $_GET['month'] : ""; $year = (isset($_GET["year"])) ? $_GET['year'] : ""; //comparaters for today's date //$todaysDate = date("n/j/Y"); //$sel = (isset($_GET["sel"])) ? $_GET['sel'] : ""; //$what = (isset($_GET["what"])) ? $_GET['what'] : ""; //$day = (!isset($day)) ? $day = date("j") : $day = ""; //comparaters for today's date //$todaysDate = date("n/j/Y"); //$sel = (isset($_GET["sel"])) ? $_GET['sel'] : ""; //$what = (isset($_GET["what"])) ? $_GET['what'] : ""; //$day = (!isset($day)) ? $day = date("j") : $day = ""; if(empty($day)){ $day = date("j"); } if(empty($month)){ $month = date("n"); } if(empty($year)){ $year = date("Y"); } //set up vars for calendar etc $currentTimeStamp = strtotime("$year-$month-$day"); $monthName = date("F", $currentTimeStamp); $numDays = date("t", $currentTimeStamp); $counter = 0; //$numEventsThisMonth = 0; //$hasEvent = false; //$todaysEvents = ""; //run a selec statement to hi-light the days function hiLightEvt($eMonth,$eDay,$eYear){ //$tDayName = date("l"); $todaysDate = date("n/j/Y"); $dateToCompare = $eMonth . '/' . $eDay . '/' . $eYear; if($todaysDate == $dateToCompare){ //$aClass = '<span>' . $tDayName . '</span>'; $aClass='class="today"'; }else{ //$dateToCompare = $eMonth . '/' . $eDay . '/' . $eYear; //echo $todaysDate; //return; $sql="select count(calDate) as eCount from calTbl where calDate = '" . $eMonth . '/' . $eDay . '/' . $eYear . "'"; //echo $sql; //return; $result = mysql_query($sql); while($row= mysql_fetch_array($result)){ if($row['eCount'] >=1){ $aClass = 'class="event"'; }elseif($row['eCount'] ==0){ $aClass ='class="normal"'; } } } return $aClass; } ?> <table width="900" cellpadding="0" cellspacing="0"> <tr> <td width="50" colspan="1"> <input type="button" value=" < " onClick="goLastMonth(<?php echo $month . ", " . $year; ?>);"> </td> <td width="250" colspan="5"> <span class="title"><?php echo $monthName . " " . $year; ?></span><br> </td> <td width="50" colspan="1" align="right"> <input type="button" value=" > " onClick="goNextMonth(<?php echo $month . ", " . $year; ?>);"> </td> </tr> <tr> <th>S</th> <th>M</th> <th>T</th> <th>W</th> <th>T</th> <th>F</th> <th class="lastOne">S</th> </tr> <tr> <?php for($i = 1; $i < $numDays+1; $i++, $counter++){ $dateToCompare = $month . '/' . $i . '/' . $year; $timeStamp = strtotime("$year-$month-$i"); //echo $timeStamp . '<br/>'; if($i == 1){ // Workout when the first day of the month is $firstDay = date("w", $timeStamp); for($j = 0; $j < $firstDay; $j++, $counter++){ echo "<td> </td>"; } } if($counter % 7 == 0){ ?> </tr><tr> <?php } ?> <!--right here--><td width="128" <?=hiLightEvt($month,$i,$year);?>><a href="<?=$_SERVER['PHP_SELF'] . '?month='. $month . '&day=' . $i . '&year=' . $year;?>&v=1"><?=$i;?></a> // TRYING TO DISPLAY CALENDAR EVENTS HERE <?php $sql="select calName,calDesc, DATE_FORMAT(calStamp, '%a %b %e %Y') as calStamp from calTbl where calDate = '" . $month . '/' . $day . '/' . $year . "'"; //echo $sql; //return; $result = mysql_query($sql); $numRows = mysql_num_rows($result); ?> <? while($row = mysql_fetch_array($result)){ ?> <div class="output"> <h5><?=$row['calName'];?></h5> <?=$row['calDesc'];?><br/> Listed On: <?=$row['calStamp'];?> </div> </td> </table> // END OF TRYING TO DISPLAY CALENDAR EVENTS HERE <?php } } ?> </p> Can anyone tell me what is wrong? Thanks! hello, i cant see why my navigation file path is not working im working on my localhost: http://localhost:8888/djsonrotation my initialize file is located at http://localhost:8888/djsonrotation/includes/initialize.php my navigation code is located at http://localhost:8888/djsonrotation/pages/pageContent/navigation/ddAccordion.php my js is located at http://localhost:8888/djsonrotation/js/ddaccordion.js if i put these on my ddAccordion.php it works Code: [Select] to find my initialize file <?PHP require_once("../../../includes/initialize.php"); ?> to find my js file <script type="text/javascript" src="../../../js/ddaccordion.js"> this is how my initialize file looks Code: [Select] <?PHP defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('SITE_DOMAIN') ? null : define('SITE_DOMAIN', 'http://localhost/djsonrotation'); defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT'].DS.'djsonrotation'); defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes'); defined('ELEMENTS') ? null : define('ELEMENTS', $_SERVER['DOCUMENT_ROOT'].DS.'djsonrotation'.DS.'pages'.DS.'contElements'); the problem is i can't seem to change ../../../ in to a file path like this does not work Code: [Select] <?PHP require_once(include(LIB_PATH.DS."initialize.php")); ?> i tried a couple of different file paths for my js file but they dont work either Code: [Select] <script type="text/javascript" src="<?php include(SITE_DOMAIN.DS."js".DS."ddaccordion.js"); ?>"> or Code: [Select] <script type="text/javascript" src="<?php include(SITE_ROOT.DS."js".DS."ddaccordion.js"); ?>"> i guess i could just use ../../../ but why are the include paths not working ???? thanks |