Jump to content

doforumda

Members
  • Posts

    300
  • Joined

  • Last visited

    Never

Everything posted by doforumda

  1. I want to use the same code which I have in my original thread. I want to extend it.
  2. I have a javascript code and want to extend this code now. how can I write a makeAMessenger function in global scope so that it triggers when user clicks document and alert THIS. IS. SPART. currently I have following code. function initiateMadness() { var sparta = { name : "Sparta" }; function madness() { alert("THIS. IS. " + this.name.toUpperCase() + "."); } document.onclick = makeAMessenger(madness, sparta); } initiateMadness();
  3. I am trying to make json data in php using json_encode() function. Then I will use this data on the client side. I acheived some of the part. My current code displays json data in this format { "data": { "tag":"home", "success":1, "error":0, "uid":"4fc8f94f1a51c5.32653037", "name":"Zafar Saleem", "profile_photo":"http:\/\/example.info\/android\/profile_photos\/profile1.jpg", "places": { "place_photo":"http:\/\/example.info\/android\/places_photos\/place1.jpg", "created_at":"2012-06-02 00:00:00", "seeked":"0" } } } { "data": { "tag":"home", "success":1, "error":0, "uid":"4fc9c413554104.22444656", "name":"Name", "profile_photo":"http:\/\/example.info\/android\/profile_photos\/profile2.jpg", "places": { "place_photo":"http:\/\/example.info\/android\/places_photos\/place2.jpg", "created_at":"2012-06-03 00:00:00", "seeked":"0" } } } { "data": { "tag":"home", "success":1, "error":0, "uid":"4fc9c48c529675.45551665", "name":"Name", "profile_photo":"http:\/\/example.info\/android\/profile_photos\/profile3.jpg", "places": { "place_photo":"http:\/\/example.info\/android\/places_photos\/place3.jpg", "created_at":"2012-06-04 00:00:00", "seeked":"20" } } } what I want to show above data in this form { "data": [ { "tag":"home", "success":1, "error":0, "uid":"4fc8f94f1a51c5.32653037", "name":"Zafar Saleem", "profile_photo":"http:\/\/example.info\/android\/profile_photos\/profile1.jpg", "places": { "place_photo":"http:\/\/example.info\/android\/places_photos\/place1.jpg", "created_at":"2012-06-02 00:00:00", "seeked":"0" } }, { "tag":"home", "success":1, "error":0, "uid":"4fc9c413554104.22444656", "name":"Name", "profile_photo":"http:\/\/example.info\/android\/profile_photos\/profile2.jpg", "places": { "place_photo":"http:\/\/example.info\/android\/places_photos\/place2.jpg", "created_at":"2012-06-03 00:00:00", "seeked":"0" } }, { "tag":"home", "success":1, "error":0, "uid":"4fc9c48c529675.45551665", "name":"Name", "profile_photo":"http:\/\/example.info\/android\/profile_photos\/profile3.jpg", "places": { "place_photo":"http:\/\/example.info\/android\/places_photos\/place3.jpg", "created_at":"2012-06-04 00:00:00", "seeked":"20" } } ] } here is my php code that generates json data database function that gets data from database public function getHome() { $result = mysql_query("SELECT * FROM places") or die(mysql_error()); // check for result $no_of_rows = mysql_num_rows($result); if ($no_of_rows > 0) { while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $data[] = $row; } return $data; /* $result = mysql_fetch_array($result); return $result; */ } else { // user not found return false; } } here is where I make json on php if($db->getHome()) { $data = $db->getHome(); foreach($data as $r) { $response['success'] = 1; $response['uid'] = $r['uid']; $response['name'] = $r['name']; $response['profile_photo'] = $r['profile_photo_path']; $response['places']['place_photo'] = $r['place_photo_path']; $response['places']['latitude'] = $r['latitude']; $response['places']['longitude'] = $r['longitude']; $response['places']['created_at'] = $r['created_at']; $response['places']['seeked'] = $r['total_completed']; echo json_encode(array('data' => $response)); } } else { $response['error'] = 1; $response['error_msg'] = 'No data available'; echo json_encode($response); }
  4. When I directly run graph api link i.e. "https://graph.facebook.com/me/home?access_token=mytoken" adding my access_token, in the browser then it shows this error { "error": { "message": "(#606) Queries for multiple source_ids require a non-zero viewer that has granted read_stream permission", "type": "OAuthException" } } any solution please?
  5. I am trying to get json data using facebook graph api through jquery. I am using the code below. I am trying to get json data using $.getJSON function but it displays this error in firebug NetworkError: 400 Bad Request - https://graph.facebook.com/me/home?access_token=mytoken here is my code <!DOCTYPE HTML> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"> </script> <script type="text/javascript" src="script/script.js"></script> <script> $(function(){ //$('fb').fbWall(); var url = "https://graph.facebook.com/me/home?access_token=mytoken"; var html = "<ul>"; $.getJSON(url, function(json){ //console.log(json); $.each(json.data, function(i,fb){ html += "<li>" + fb.id + "</li>"; }); }); html += "</ul>"; $('.fb').animate({opacity: 0}, 500, function() { $('.fb').html(html); }); $('.fb').animate({opacity:1}, 500); }); </script> <!-- <link type="text/css" rel="stylesheet" href="styles.css" /> --> <style> .fb { width: 400px; height: 400px; border:1px solid red; } </style> <title>title</title> </head> <body> <div class="fb"> </div> </body> </html> where am I making mistake?
  6. I am making a mobile web app. This app will get news from yahoo. I am currently using jquery plugin to get these news. I am also using jquery mobile for interface. On the index page I have listview and it contains all the titles such as Top News, World News, Sports News etc. Here is index page code <html> <head> <title>Title</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width = device-width, initial-scale = 1, user-scalable = no" /> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css" /> <script src="http://code.jquery.com/jquery-1.6.2.min.js"></script> <script src="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.js"></script> </head> <body> <div data-role="page"> <header data-role="header"> <h1>Yahoo News</h1> </header> <div data-role="content"> <ul data-role="listview" data-inset="true"> <li><a href="topNews.php" data-transition="slidedown">Top Stories</a></li> <li><a href="worldNews.php" data-transition="slidedown">World News</a></li> <li><a href="techNews.php" data-transition="slidedown">Technology</a></li> <li><a href="scienceNews.php" data-transition="slidedown">Science</a></li> <li><a href="enterNews.php" data-transition="slidedown">Entertainment</a></li> <li><a href="sportsNews.php" data-transition="slidedown">Sports</a></li> </ul> </div> <footer data-role="footer"> <h4>Footer</h4> </footer> </div> </body> So when USer clicks lets say Top Stories then it will take user to appropriate page and display top news on that page. Now it does take user to top news page but when he gets there he does not see any news. That page is empty. But when user refresh this page by clicking refresh button of the browser then it does show all the news. So my problem is that it should display the news as top news page is displayed. here is top news page code <html> <head> <title>Title</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width = device-width, initial-scale = 1, user-scalable = no" /> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css" /> <link href="styles.css" rel="stylesheet" type="text/css" /> <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.js"></script> <script language="javascript" type="text/javascript" src="jquery.jfeed.js"></script> <script language="javascript" type="text/javascript" src="jquery.aRSSFeed.js"></script> <script type="text/javascript"> $(document).ready( function() { $('div.RSSAggrCont').aRSSFeed(); }); </script> </head> <body> <div data-role="page"> <header data-role="header"> <a href="#" data-transition="slidedown" data-rel="back" data-icon="arrow-l">Back</a> <h1>Top News</h1> </header> <div data-role="content"> <div class="RSSAggrCont" rssnum="5" rss_url="http://rss.news.yahoo.com/rss/topstories"> </div> </div> <footer data-role="footer"> <h4>Footer</h4> </footer> </div> </body> Can someone tell me where am I making mistake? Any solution Please
  7. How can I get the comments from below json data? { "data": [ { "id":"123", "from":{"name":"name","id":"12"}, "message":"Message", "comments": { "data": [ { "id":"342", "from":{"name":"name","id":"32"}, "message":"comment message 1" }, { "id":"341", "from":{"name":"name","id":"21"}, "message":"comment message 2" } ], "count":2 } }, { "id":"143", "from":{"name":"name","id":"52"}, "message":"Message", "comments": { "data": [ { "id":"362", "from":{"name":"name","id":"72"}, "message":"comment message 1" }, { "id":"341", "from":{"name":"name","id":"41"}, "message":"comment message 2" } ], "count":2 } } ] } I know how to get id, from and message. but I do not know how can I get data inside comments. here is my jquery code $.getJSON(newsfeed_url,function(d) { $.each(d.data, function(i,res) { html += "<div class='container'>"; html += "<li>"+ res.from.name +"</li>"; html += "<li class='message'>" + res.message + "</li>"; html += "<li>Comments: " + res.comments.count + "</li>"; $.each(res.comments.data, function(i, comment) { html += "<li class=''>" + comment.message + "</li>"; }); html += "</div>"; }); html += "</ul>"; $("#contents").html(html); }); my current code does get res.from.name, res.comments.count but it does not get data inside comments i.e. res.comments.data. how can I achieve it?
  8. Now I changed my .js file to this code. I am using getJSON to get photos from the server $(function(){ $('.thumbs').click(function() { var thisid = $(this).attr('id'); var url = 'http://localhost/shirt/shirt/get_tshirt'; $.getJSON(url,{id: thisid},function(data){ alert(data.shurturl); $('#contents').append("<img src='" + data.shirturl + "' />"); }); }); }); I am using php with codeigniter on the servside. here is the code for my controller <?php class Shirt extends CI_Controller { public function index() { $this->shirt_thumbs(); } public function shirt_thumbs() { $data['rows'] = $this->Model_shirt_thumbs->get_thumbs(); //var_dump($data); $this->load->view('view_home',$data); } public function get_tshirt() { extract($_GET); $sql = "SELECT * FROM shirts WHERE shirtid=$id"; $query = mysql_query($sql); while($row = mysql_fetch_assoc($query)) { $rows[] = array( "shirtid" => $row['shirtid'], "shirt_thumb" => $row['shirt_thumburl'], "shirturl" => $row['shirturl'] ); } $json = json_encode($rows); //$callback = $_GET['callback']; echo $json; } } ?> here is what I am getting back from the as json data [{"shirtid":"5","shirt_thumb":"shirt_designs\/thumbs\/thumb_blue_one.png","shirturl":"shirt_designs\/blue_one.png"}] but when I alert shirturl then it displays "undefined" anyone who can help? Please
  9. I am using json to display images using php codeigniter. What I am trying to do is when I click a particular t shirt image then it should display on container div tag. Currently I am getting json code in this format [{"rows":[{"shirtid":"8","shirt_thumburl":"shirt_designs\/thumbs\/thumb_blue_four.png","shirturl":"shirt_designs\/blue_four.png"}]}] So Now how can I get the shirturl from this json data to display that particular image? here is my code here is my controller class Shirt extends CI_Controller { public function index() { $this->shirt_thumbs(); } public function shirt_thumbs() { $data['rows'] = $this->Model_shirt_thumbs->get_thumbs(); //var_dump($data); $this->load->view('view_home',$data); } public function get_tshirt() { extract($_POST); $data['rows'] = $this->Model_shirt_thumbs->get_tshirt($id); $JSON_array = array($data); $JSON_response = json_encode($JSON_array); header('Contents: type/json'); echo $JSON_response; } } here is my .js file $(function(){ $('.thumbs').click(function() { var thisid = $(this).attr('id'); var url = 'http://localhost/shirt_designer/shirt/get_tshirt/'; $.ajax({ type: 'POST', url: url, data: 'id=' + thisid, dataType: 'json', success: function(result) { $('#contents').html(result.shirtid); } }); }) });
  10. Hi all, I am making a t shirt website. I have about eight t-shirt thumbnails and these thumbnails are inside div tag with class 'thumbs'. Inside this thumbs div I have hidden input field as well. The value of thumbs div is the ID of the current thumbnail which taken from mysql database. Now what am I trying to do is when user clicks thumbs div tag then in javascript it should alert me the value of hidden input of this clicked thumbs div tag. Currently it displays only the first thumbnails hidden input value i.e. 1. SO How can I make this work so that when user clicks thumbs div tag, the value of that clicked thumbs' hidden input must be alerted? here is my code so far here is thumbs page <!DOCTYPE HTML> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript" src="script/script.js"></script> <link type="text/css" rel="stylesheet" href="styles/styles.css" /> <title>title</title> </head> <body> <div id="left_menu"> <div id="tshirt_thumbs_container"> <?php if($rows) : ?> <?php foreach($rows as $r) : ?> <?php echo ""; ?> <?php echo "<div class='thumbs'>"; ?> <?php echo "<img src='" . $r->shirt_thumburl . "' />"; ?> <?php echo "<input type='hidden' id='thumbid' value='" . $r->shirtid . "' />"; ?> <?php echo "</div>"; ?> <!-- thumbs --> <?php endforeach; ?> <?php endif; ?> </div> </div><!-- left_menu --> <div id="contents"></div> </body> </html> here is .js file $(function(){ $('.thumbs').click(function() { var thisid = $(this + 'input[type="hidden"]').val(); //var thisid = $(this + " #thumbid").attr('id'); alert(thisid); }) }); please help
  11. Hi, I am trying to display text from database in proper format but it is not working the way I want. First here is how the data is stored in database table in "desc" column [p]Today we are going to learn how can we connect to mysql database using php. It is very important to know because connecting to database is the backbone of any web application.[p] [p]So here you go![p] [p]Below is the sample code for connecting to database. Explanation for this demo is below the code[p] [c] $connect = mysql_connect("localhost","username","password"); $database = mysql_select_database("database_name"); $query = mysql_query("SELECT * FROM table_name"); [c] [p]So the first two lines are enough for connecting to database. Whereas the third line is only for querying database table to get records from a table table_name[p] [p]This was today's tutorial. Hope you like it. If you like it then like us on facebook.[p] [c] $connect = mysql_connect("localhost","username","password"); $database = mysql_select_database("database_name"); $query = mysql_query("SELECT * FROM table_name"); [c] and here is how I am trying to display it <?php $p = string_between($desc,'[p]'); ?> <?php $c = string_between($desc,'[c]'); ?> <?php $total = count($p) + count($c); ?> <?php for($i = 0; $i < $total; $i++) : ?> <?php if(isset($p[$i]) && $p[$i] != "") { ?> <?php echo "<p>" . $p[$i] . "</p>" ?> <?php } ?> <?php if(isset($c[$i]) && $c[$i] != "") { ?> <?php echo "<p><pre class='prettyprint'>" . $c[$i] . "</pre></p>" ?> <?php } ?> <?php endfor; ?> so this code displays data in this format Today we are going to learn how can we connect to mysql database using php. It is very important to know because connecting to database is the backbone of any web application. $connect = mysql_connect("localhost","username","password"); $database = mysql_select_database("database_name"); $query = mysql_query("SELECT * FROM table_name"); So here you go! $connect = mysql_connect("localhost","username","password"); $database = mysql_select_database("database_name"); $query = mysql_query("SELECT * FROM table_name"); Below is the sample code for connecting to database. Explanation for this demo is below the code So the first two lines are enough for connecting to database. Whereas the third line is only for querying database table to get records from a table table_name This was today's tutorial. Hope you like it. If you like it then like us on facebook. As you can see the code is displaying in the wrong place. the first block of code should be displayed after third paragraph. And the second block of code should be displayed at the end because the blocks are stored in this way. How can I display it the way it is in database? help!
  12. ok but how can I get that particular code which I want to put it in code snipet. for example below is the whole blog Here is we can out put string in php echo "Hello world"; So in above example I want to display "Here is how we can output string in php" normally but when it reaches to 'echo "Hello world"' then it must be put in code snippet. So how can I manage this behavior?
  13. Hi, I am getting description column from mysql db. In that description I have codes such php code. and that code is surrounded by a code /code words. So how can I display that code in proper format? Please help.
  14. Hi. I want to use json with php. I am getting data from database. now I want to format that in this way { msg: [{"id":"1"},{"id":"2"},{"id":"3"},{"id":"4"},{"id":"5"}]} to work with it on client side using json. here is my php code include("db.php"); $query = mysql_query("SELECT * FROM data_table"); $id = ""; while($row = mysql_fetch_assoc($query)){ $id = $row['id']; $JSON_array['msg'] = array(); $JSON_array['msg']['id'] = $id; $JSON_response = json_encode($JSON_array); header("Contents: type/json"); echo $JSON_response; } help please
  15. Yea I know it would be easy but I making these input form fields dynamically using php's echo. this is just demo to get help. here is how i am making that form right now if(!($_SESSION['userid'] && $_SESSION['username'])) { header("Location: error.php"); } else { echo "<button name='edit' id='edit'>Edit</button>"; echo "<button name='delete' id='delete'>Delete</button>"; echo "<button name='addAttorney' id='addAttorney'>Add Attorney</button>"; echo "<table cellpadding='2' border='0'>"; echo "<tr>"; //start of the titles row echo "<td></td>"; echo "<td><b>Name</b></td>"; echo "<td><b>Email</b></td>"; echo "<td><b>Address</b></td>"; echo "<td><b>Mobile Number</b></td>"; echo "<td><b>Validity</b></td>"; echo "<td><b>Code</b></td>"; echo "</tr>"; // end of the titles row $get_poa = mysql_query("SELECT * FROM permanentattorneyinfo WHERE userid='$_SESSION[userid]'"); if(mysql_numrows($get_poa) > 0) { while($row = mysql_fetch_assoc($get_poa)) { $attorneyName = $row['nameOfAttorney']; $attorneyAddress = $row['addressOfAttorney']; $attorneyMobile = $row['mobileOfAttorney']; $attorneyEmail = $row['emailOfAttorney']; $validFrom = $row['validFrom']; $validTo = $row['validTo']; $code = $row['poaCode']; echo "<tr class='lightgrey'>"; //start of the data row echo "<td><input type='checkbox' name='delete[]' value='$attorneyName' /></td>"; echo "<td>$attorneyName</td>"; echo "<td>$attorneyEmail</td>"; echo "<td>$attorneyAddress</td>"; echo "<td>$attorneyMobile</td>"; echo "<td>$validFrom - $validTo</td>"; echo "<td>$code</td>"; echo "</tr>"; // end of the data row } echo "</table>"; //End of table } else { echo "You do not choose power of attorney yet!"; } }
  16. hi, I am trying to use checkboxes with jquery and php. I am submitting checkboxes to php file using jquery. but what I want to do is to get checked checkboxes and send to php file and display all the checked values. Here is my current code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript" src="jquery-lib.js"></script> <script> $(function() { $('#submit').click(function() { var inp = $('input:checkbox').val(); //alert(inp); var url = 'test1process.php?inp=' + inp; $(location).attr('href',url); }); }); </script> </head> <body> <input type="checkbox" name="checkbox[]" id="checkbox" value="a" />A<br /> <input type="checkbox" name="checkbox[]" id="checkbox" value="b" />B<br /> <input type="checkbox" name="checkbox[]" id="checkbox" value="c" />C<br /> <input type="checkbox" name="checkbox[]" id="checkbox" value="d" />D<br /> <input type="checkbox" name="checkbox[]" id="checkbox" value="e" />E<br /> <input type="checkbox" name="checkbox[]" id="checkbox" value="f" />F<br /> <input type="checkbox" name="checkbox[]" id="checkbox" value="g" />G<br /> <input type="button" name="submit" id="submit" value="Submit" /> </body> </html> here php file <?php $inp = $_GET['inp']; if(count($inp) > 0) { for($i = 0; $i < count($inp); $i++) { echo "Value: $inp[$i]<br>"; } } ?> please help!
  17. ok here is my html page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link type="text/css" rel="stylesheet" href="css/styles.css" /> <script type="text/javascript" src="js/jquery-lib.js"></script> <script type="text/javascript" src="js/script.js"></script> <title>Dream City</title> </head> <body> <?php $_SESSION['userid'] = "1"; $_SESSION['username'] = "zafar"; ?> <div id="contents"> <div id="tabsContainer"> <div id="tabBody" class="tabs">Body</div> <div id="tabMind" class="tabs">Mind</div> <div id="tabBusiness" class="tabs">Business</div> <div id="tabArts" class="tabs">Arts</div> <div id="tabEnvironment" class="tabs">Environment</div> </div><!-- tabsContainer --> <div id="tabsContentsWrapper"> <div class="haveYourDefinition" id="haveYourDefinition">Have your Definition</div><!-- haveYourDefinition --> <div id="videosList" class="list"><ul></ul><div id="videosLoader"></div></div> <div class="haveYourDefinitionFooter">Video Title / Username / Date</div> <div class="haveYourDefinition">Have your Definition</div><!-- haveYourDefinition --> <div class="list">Photos</div> <div class="haveYourDefinitionFooter">Video Title / Username / Date</div> </div><!-- tabsContents --> </div><!-- contents --> </body> </html>
  18. hi I am fetching thumbnails of youtube videos but it does not show up. I am doing this using PHP, JQuery ajax. The problem is it does not show any error. it displays all the links to thumbnails but it does not display it. Here is my code <?php require("database/db.php"); include "functions/ytVideoId.php"; $getVideos = mysql_query("SELECT * FROM dc_videos LIMIT 9"); if(mysql_numrows($getVideos) > 0) { while($rowVideos = mysql_fetch_assoc($getVideos)) { $video = $rowVideos['videoUrl']; $videoId = ytVideoId($video); echo "http://i1.ytimg.com/vi/$videoId/default.jpg "; } } else echo "No videos found!"; ?> here is my javascript file $(function() { $('#tabBody').click(function(){ $('#tabBody').addClass('tabActive'); //alert("hello"); var url = "videos.php"; $.ajax({ type: 'POST', url: url, success: function(result) { alert(result); $('#videoList').html("<img src='" + result + "' alt='Preview Not Available' />"); } }); }); }); this is what i get as a result in js file http://i1.ytimg.com/vi/VjWJhA_4M9g/default.jpg http://i1.ytimg.com/vi/Rln9Z7w1A1w/default.jpg http://i1.ytimg.com/vi/GXK6tf16ue8/default.jpg http://i1.ytimg.com/vi/Uq1jsb9LqHo/default.jpg http://i1.ytimg.com/vi/Yg7K36i8B4c/default.jpg http://i1.ytimg.com/vi/YVwcbI8iuxo/default.jpg http://i1.ytimg.com/vi/xqvxlhqGHTY/default.jpg http://i1.ytimg.com/vi/PHk302o4VFk/default.jpg http://i1.ytimg.com/vi/hSuik_fu-WM/default.jpg please help
  19. hi, I am displaying mysql data in a table form using php. The first attached pic shows how is it looking with the current code. As you can see there are heading on the left and top of the table. So user can make booking on a specific day (heading is on the top for days) and for specific duration of time(headings are on the left). As in first pic, there has been a booking on Wed at 10 o clock, but the problem is, it is displaying duration just for half an hour. As this duration is from 10 o clock to 11 o clock. So what I want to do is in the second pic. Please view the second pic. In the second pic I want to display the highlighted area in blie because all this time is booked or reserved. Here is my current code. <?php require("dbconnect/dbconnect.php"); $building = $_POST['building']; $block = $_POST['block']; $d_m = $_POST['d_m']; $choose_one = $_POST['choose_one']; function get_data($table, $choose_one) { $bool = 1; $get_days = mysql_query("SELECT * FROM days"); $get_times = mysql_query("SELECT * FROM time"); $days = mysql_num_rows($get_days); //$row_day_id = mysql_fetch_assoc($get_days); //$day_id_db = $row['dayid']; echo "<table cellspacing='0' border='0' cellpadding='5'> <tr> <th scope='col' width='100'></th>"; while($row_time = mysql_fetch_assoc($get_times)) { while($bool <= $days) { $row_days = mysql_fetch_assoc($get_days); $dayname = $row_days['days']; echo " <th scope='col' width='100'>$dayname</th> "; $bool++; } $day_id = 1; $timeid = $row_time['timeid']; $time = $row_time['time']; echo " <tr> <th scope='row' width='100' height='50'>$time</th>"; while($day_id <= $days) { $get = mysql_query(" SELECT * FROM $table WHERE dayid='$day_id' AND timeid_from='$timeid' AND d_m='$choose_one' ") or die(mysql_error()); if(mysql_numrows($get) > 0) { $row = mysql_fetch_assoc($get); $block = $row['block']; $apt = $row['apartment_no']; $room = $row['room_no']; $d_m = $row['d_m']; $timeid_to = $row['timeid_to']; echo " <td width='110' height='50' bgcolor='lightblue'> <b>Block:</b> $block<br /> <b>Apartment:</b> $apt<br /> <b>Room:</b> $room </td> "; //echo "</tr>"; } else { echo " <td width='110' height='50' bgcolor='green'></td> "; } $day_id++; } //end of second inner while loop echo "</tr>"; } //end of outer while loop echo "</table>"; } if($building) { if($block) { if($d_m) { if($choose_one) { if($building == 'mik') { if($block == 'Block A' || $block == 'Block B') { get_data('reserve_mik_ab', $choose_one); } else if ($block == 'Block C' || $block == 'Block D') { get_data('reserve_mik_cd', $choose_one); } } if($building == 'p') { get_data('reserve_p',$choose_one); } } else { echo "Choose one!"; } } } } ?> Please help! [attachment deleted by admin]
  20. This is not the problem. I did this way but it still displaying this error. any other solution please...
  21. I am making login system using codeigniter. When I run my code i get this error. The requested URL /ci_login/user/login was not found on this server. here is my code so far user.php file which is in controller folder <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class User extends CI_Controller { function __construct() { parent::__construct(); } function index() { } function login() { if($this->form_validation->run() == FALSE) { $this->load->view('view_login'); } else { echo "Successfull"; } } } view_login.php file which is in view folder <html> <head> <title>Login</title> </head> <body> <h1>Please Login!</h1> <p>Use the login form below to login.</p> <div id="login_form"> <?php echo form_open(base_url(). 'user/login' ) ?> <label>Username:</label> <div> <?php echo form_input(array('id' => 'username', 'name' => 'username')); ?> </div> <label>Password:</label> <div> <?php echo form_password(array('id' => 'password', 'name' => 'password')); ?> </div> <div> <?php echo form_submit(array('name' => 'submit'),'Login'); ?> </div> <?php echo form_close(); ?> </div> </body> </html> help please how can I solve this error?
  22. Hi I am new to codeigniter. I am making a login system. I just finished login form but when i hit login button then it displays this error The requested URL /ci_login/user/login was not found on this server. here is my code so far user.php file which is in controller forlder <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class User extends CI_Controller { function __construct() { parent::__construct(); } function index() { } function login() { if($this->form_validation->run() == FALSE) { $this->load->view('view_login'); } else { echo "Successfull"; } } } view_login.php file which is in view folder <html> <head> <title>Login</title> </head> <body> <h1>Please Login!</h1> <p>Use the login form below to login.</p> <div id="login_form"> <?php echo form_open(base_url(). 'user/login' ) ?> <label>Username:</label> <div> <?php echo form_input(array('id' => 'username', 'name' => 'username')); ?> </div> <label>Password:</label> <div> <?php echo form_password(array('id' => 'password', 'name' => 'password')); ?> </div> <div> <?php echo form_submit(array('name' => 'submit'),'Login'); ?> </div> <?php echo form_close(); ?> </div> </body> </html> help please how can I solve this error?
×
×
  • 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.