Jump to content

vikrantmohite

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

vikrantmohite's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. <?php $string ="Anything you want here"; //your string here $array=str_split($string); If(ord($array[0])>=65 AND ord($array[0])<=90) echo "First letter is Capital"; If(ord($array[1])>=65 AND ord($array[1])<=90) echo "Second letter is Capital"; ?>
  2. replace $handle = fopen($file,"r"); with $handle = @fopen($file,"r"); This will check whether the file can be read or not and allow further script to execute only if $handle is true. Hope this works for you.
  3. Thanks PFMaBiSmAd I got the solution I was getting a lot of white spaces while inserting data so data was not getting inserted into the table. I used trim() to remove white spaces and now everything is workin fine. Thanks to all for your support and response.
  4. Can anyone suggest me what I am doing wrong?
  5. index.php <?php # don't forget the library include('simple_html_dom.php'); # this is the global array we fill with article information $trains = array(); # passing in the first page to parse, it will crawl to the end # on its own getArticles('http://www.makemytrip.com/railways/mumbai_sawantwadi_s-01013-train.html'); function getArticles($page) { global $trains, $con; $html = new simple_html_dom(); $html->load_file($page); $con = mysql_connect("localhost","root",""); mysql_select_db("temp",$con); /* foreach($html->find('table tr.segonroute1') as $e) { //$details[] = $e->children(1)->outertext; //echo $e->children(1)->outertext; } */ $route = $html->find('table tr.segonroute1'); foreach($route as $key) { $trains[]=array( $key->children(1)->plaintext, $key->children(2)->plaintext, $key->children(3)->plaintext, $key->children(4)->plaintext, $key->children(5)->plaintext, $key->children(6)->plaintext ); //mysql_query("INSERT INTO trains (station_name, arrives, departs, halt_time, distance, train_no) VALUES ('".$key->children(1)->outertext.""); } } foreach($trains as $item) { echo $item[0]; $s = (string) $item[0]; echo " ".$item[1]; echo " ".$item[2]; echo " ".$item[3]; echo " ".$item[4]; echo " ".$item[5]."<br/>"; //mysql_query("INSERT INTO trains (station_name, arrives, departs, halt_time, distance, train_no) VALUES ('$item[0]','$item[1]','$item[2]','$item[3]','$item[5]',01013"); $q="INSERT INTO trains (station_name) VALUES ('$s')"; mysql_query($q,$con); } ?> simple_html_dom.php is attached here . 18569_.php
  6. I am not able to insert data into table. I have some data in array. If I use echo array[index] I can see the data. But when I try to insert the data in database I am getting blank data in table. Can you please help me guys.
  7. Hi Experts, I am designing an application of bus reservation system. I am stuck with database design of the application. Hope you people can help me on this. Each bus have unique ID (say BUS NO), source & destination. Now let say for Bus B123 source is A and destination is X and in between it stops at C,Z,N,H,K also. Bus B456 source is C and destination is Y and in between it stops at Z,N,K,P,Q,R,T,I,D also. Bus B789 source is G and destination is S and in between it stops at N,H,K,D,M also. Now if user search for bus from C to H it should give B123 N to K it should give B123, B456, B789 K to D it should give B456, B789 Again if he search for Bus from H to C it should not give B123 (i.e the bus goes only from C to H and not from H to C) The fact that need to consider here is the sequence. I can't keep all stations in sequence as admin may want to update the route(adding or deletion of station) in future. I hope you have understood what I am planning to design. Please help me with this design. I have to create this design in MySQL. Please do reply if you don't understand the requirement or have any doubt. Looking forward for your valuable comments and suggestions Regards, Vikrant Note : Station names can be different for simplicity I have used alphabates. Stations don't follow any alphabetic order.
  8. form.php <form action='anotherPage.php' method='post> ... form elements ... </form> anotherPage.php <?php $_post['txtBox'] // collect info to send and do database insertion here ?> <html> ......... Some HTML Code.......... </html>
  9. Hi, I want to generate a 10 digit PNR number in one of my application. The PNR number to be generated should use the following : 1. The name of the passenger(s). 2. Contact details for the travel agent or airline office. (The minimum contact information enforced by CRS policy is typically the 8-digit IATA code of the travel agency or airline office, although there is usually at least one phone number as well, most often the agency phone number. Direct customer contact information is rarely required.) 3. Ticketing details, either a ticket number or a ticketing time limit. 4. Itinerary of at least one segment, which must be the same for all passengers listed. 5. Name of the person providing the information. (This is usually entered in a "received from" field and recorded in the "history" or change log attached to the PNR, along with the user and office or agency ID of the airline or travel agency employee creating the PNR or entering the change. The "history" records the "received from" data separately for the initial creation of the PNR and for each subsequent change to it.) For better understanding of PNR follow http://en.wikipedia.org/wiki/Passenger_name_record I was planning to do MD5() on all the above fields but that will give me more than 10 letters(alphanumeric) Though it is mention in wiki that PNR can be Alphanumeric, I want to generate a Numeric PNR. Please help me on this. Regards, Vikrant
  10. Hi guys, I have stored some records in my table where table contains a column timestamp where I am storing a timestamp. I want to extract records for particular month with this timestamp. How I can write query for it??
  11. My function get called But I am not getting response properly. Rather than getting only requested output I am getting whole HTML page as output in response. I have tested it in firebug
  12. I am building application from scratch in MVC framework. I am not using CodeIgniter. I am using controller admin.php. ..//application/controllers/admin.php
  13. Thanx for quick reply. I am using MVC So I have to call a function in controller which inturn receive data from model. admin is controller class and getCity is its method. getCity method calls model and receives data from it. So I dont think admin/index/getCity is going to work for me. mu Url is like localhost/application/controller/{method}/{arg if any} structure
  14. I have design my php application now I want to make it accessible using https://localhost. Currently i am using http://localhost. How I can do that without doing any changes in XAMPP (I am using XAMPP to run my application). Is it possible to do me so just by modifyinng .htaccess file or something called php.ini file( I have zero knowledge about this file).
×
×
  • 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.