Jump to content

Nandini

Members
  • Posts

    160
  • Joined

  • Last visited

    Never

Everything posted by Nandini

  1. Hi Everybody I am doing online education portal. Teachers and students will be registered on this site. Student will search teachers and create schedule to learn subjects. For that student can pay to the teacher some amount. So that student can increase his/her balance. That means he can transfer some money to website company account through credit card or paypal or google checkout. I did credit card part. But i am not getting any idea to do in paypal. That means student can enter amount and click paypal button, it should show paypal page. So that he can login into his paypal account and pay that amount. After pay that amount we can get IPN (Instant Payment Notification). So that we can store that amount into my database under that student ID. Please tell me how can i do this?
  2. Thanq Robert. If we should not loop more than once, how can i solve this issue. Please let me know.
  3. Hi I am using php5 and Mysql I want to generate user id like phone format (Ex: xxx-xxx-xxxx). and check that user id exists in database or not. if yes, i have to generate new user id etc. If that user id not in database, i have to insert user id for new user. Means i have generate unique user id for login purpose. Generating user id is working fine. availability of user id also ok for me by using mysql_num_rows() function. But if user id i exists in database, how can i generate new user id. All this will be done in single instance (When user click on submit button from registration form). Here is my script. <?php function UserID() { $starting_digit=5; $first_part1=rand(0,99); if(strlen($first_part1)==1) { $first_part="0".$first_part1; } else { $first_part=$first_part1; } $second_part1=rand(1,999); if(strlen($second_part1)==1) { $second_part="00".$second_part1; } elseif(strlen($second_part1)==2) { $second_part="0".$second_part1; } else { $second_part=$second_part1; } $third_part1=rand(1,9999); if(strlen($third_part1)==1) { $third_part="000".$third_part1; } elseif(strlen($third_part1)==2) { $third_part="00".$third_part1; } elseif(strlen($third_part1)==3) { $third_part="0".$third_part1; } else { $third_part=$third_part1; } $userid=$starting_digit.$first_part."-".$second_part."-".$third_part; return $userid; } $random_userid=UserID(); $sql=mysql_query("select * from users where user_id='".$random_userid."'"); if(mysql_num_rows($sql)==0) { $insert=mysql_query("insert into users (user_id) values ('".$random_userid."')"); } ?> If user id not exists in database, that user id inserting in database successfully. If not, empty value is inserting, not generating new user id. Can any one help me out please.
  4. I am not trimming any value. Ho can i do this. I am not well in php. Please
  5. Hi all I have one database filed like price with DECIMAL(30,2). While inserting values, those values are rounding. I am inserting values through PHP Coding. For example, I am inserting 5.625 but it is inserting as 5.63 I want to insert value 5.625 as 5.62. I have taken datatype as DECIMAL(30,3) but no use. Here is my code <?php mysql_connect("localhost","root",""); mysql_select_db("sample"); echo "Product Volume: 3.75<br>"; echo "Amount: 1.5<br>"; $total=3.75*1.5; echo "Total: ".$total; $total_insert=mysql_query("insert into test (price) values ('".$total."')"); ?>
  6. I got a final array like this Array ( [0] => id: 28 [1] => property_id: 691 [2] => report_id: 28 [3] => no_records: 0 [4] => bankruptcy: 0 [5] => foreclosure: 0 [6] => accounts: 45 [7] => publicrecords: 34 [8] => summary: 1 [9] => id_date: 06/24/2011 15:47:46 ) I want to display 3 values per row. But same values coming for every row. Here is my code. <?php echo "<table border='1' width='400'>"; $thumbrows=count($credit_array)/3; for($r=0;$r<$thumbrows;$r++) { echo '<tr>'; for($c=0;$c<3;$c++) { echo '<td>'.$credit_array[$c].'</td>'; } echo '</tr>'; } echo "</table>"; ?> Can any one tell me what is the problem.
  7. ya its working fine. But how can i set 3 values per row in table. please
  8. output for $row1 is: Array ( [id] => 28 [property_id] => 691 [report_id] => 28 [no_records] => 0 [bankruptcy] => 0 [foreclosure] => 0 [accounts] => 45 [collection] => [title] => [mortgagerepo] => [mortgagechargeoff] => [paid_off] => [charge_off] => [past_due] => [current] => [unknow] => [publicrecords] => 34 [judge] => [repos] => [summary] => 1 [comments] => [comments1] => [id_date] => 06/24/2011 15:47:46 )
  9. Otherwise Tell me how can i run query to get all the filled MySQL fields. I don't want to get empty fields. I don't know which field is empty and which field is not empty.
  10. I am getting errors by using this code. Warning: Invalid argument supplied for foreach() in here is my code <?php $sql=mysql_query("select * from report where report_id='28'"); $row1=mysql_fetch_assoc($sql); echo '<table>'; foreach($row1 as $k=>$v) { echo '<tr>'; foreach($v as $field) { if(trim($field['accounts']) != '') echo '<td>'.$field['accounts'].'</td>'; } echo '</tr>'; } echo '</table>'; ?>
  11. hi we don't want empty cells. Check my example in our question.
  12. This is fine. But i have to fit 3 fields into one <tr>. How can i got to next <tr>. Why because we don't know how many fields are filled.
  13. I mean i want to display only non empty fields.
  14. Hi I have database table 'credit' as follows idaccountspaidchargecurrentpast 10543[/td][td]3465 So i want to display the output as follows (this is in table format. Each value divisible by <td>) accounts: 543current: 34past: 65 If accounts field not filled (means empty) output like this (this is in table format. Each value divisible by <td>) current: 34past: 65 How can i do this with PHP
  15. thanks its working But how can i retrieve teacher details who is not in subjects table. All this information should come by using single query. Why because i am using in search.
  16. Hi I have a two mysql tales as follows Table Teachers: teacher_idfirst_namelast_namestate 1testTHI 2testT2LA Table Subjects: teacher_idmain_subjectsub_subjectISBN 1MathsElemntary Maths452635 1MathsAlgebra452336 2EnglishGrammer645455 2EnglishVocabulary7435435 Now i want to display, who is teacher having first_name as test and having main_subject as Maths and sub_subject as Elemntary Maths . I am using the following code. But i am getting two rows. select a.*,b.* from Teachers a,Subjects b where a.first_name = 'test' && b.main_subject = 'Math' && b.sub_subject = 'Elementary Math' How can i do this. please tell me
  17. Hi all I am adding some positive and negative numbers. But i am getting strange output. Can anyone help me Here is the code. $sum=7.50+6.45+12.90+12.00+13.00+0.61+32.00+4.00+27.00+18.00+10.88+129.50+92.94-100.00-38.25+76.80-305.33; echo "<br>Total: ".$sum; Basically i have to get Total is 0 but i am getting total is 5.6843418860808E-14 Can anyone help me out Please
  18. Hi i want to match $ symbol from the string. I am using the following script $str="ckj"; if(preg_match("/^$/",$str)) { echo "Dollar is found"; } else { echo "Not Found"; } Its not working fine. Can anyone help me out please.
  19. By using this code output displaying as follows inspection_area_tlb inspection_area item_name item_value yard_and_lot yard and Lot PID Signage/unauthorized sign on pole 0 yard_and_lot yard and Lot Landscape well maintained 0 yard_and_lot yard and Lot pumps clean and free of dirt 0 yard_and_lot yard and Lot Approved trash cans/clean 0 pump_island Pump Island and Canopies PID Signage/unauthorized sign on pole 0 pump_island Pump Island and Canopies Landscape well maintained 0 pump_island Pump Island and Canopies pumps clean and free of dirt 0 pump_island Pump Island and Canopies Approved trash cans/clean 0 But this is wrong. I want out put as like in our question
  20. Hi I have a XML file as follows: <?xml version="1.0"?> <inspection_form> <inspection_type> <inspection_area_tlb>yard_and_lot</inspection_area_tlb> <inspection_area>Yard and Lot</inspection_area> <items> <item> <item_name>PID Signage/unauthorized sign on pole</item_name> <item_value>0</item_value> </item> <item> <item_name>Landscape well maintained</item_name> <item_value>0</item_value> </item> </items> </inspection_type> <inspection_type> <inspection_area_tlb>pump_island</inspection_area_tlb> <inspection_area>Pump Island and Canopies</inspection_area> <items> <item> <item_name>pumps clean and free of dirt</item_name> <item_value>0</item_value> </item> <item> <item_name>Approved trash cans/clean</item_name> <item_value>0</item_value> </item> </items> </inspection_type> </inspection_form> I want to insert into DB as follows: inspection_area_tlb inspection_area item_name item_value yard_and_lot yard and Lot PID Signage/unauthorized sign on pole 0 yard_and_lot yard and Lot Landscape well maintained 0 pump_island Pump Island and Canopies pumps clean and free of dirt 0 pump_island Pump Island and Canopies Approved trash cans/clean 0 I have written some php code. But every item node as insert for every 'inspection_type'. This is my code $filename="sample.xml"; if(filesize($filename)>0) { $oDOM = new DOMDocument(); $oDOM->loadXML(file_get_contents($filename)); foreach ($oDOM->getElementsByTagName('inspection_type') as $oBookNode) { foreach ($oDOM->getElementsByTagName('item') as $itmNode) { $sSQL = sprintf( "INSERT INTO inspections_master_tablename_import (INSPECTION_TYPE_DB_C_NAME, INSPECTION_TYPE_C_NAME, INSPECTION_TYPE_ITEM_C_NAME,INSPECTION_TYPE_ITEM_VALUE_C_NAME) VALUES ('%s', '%s', '%s', '%s')", mysql_real_escape_string($oBookNode->getElementsByTagName('inspection_area_tlb')->item(0)->nodeValue), mysql_real_escape_string($oBookNode->getElementsByTagName('inspection_area')->item(0)->nodeValue), mysql_real_escape_string($itmNode->getElementsByTagName('item_name')->item(0)->nodeValue), mysql_real_escape_string($itmNode->getElementsByTagName('item_value')->item(0)->nodeValue) ); $rResult = mysql_query($sSQL); if(mysql_errno() > 0) { printf( '<h4 style="color: red;">Query Error:</h4> <p>(%s) - %s</p> <p>Query: %s</p> <hr />', mysql_errno(), mysql_error(), $sSQL ); } } } } Can anyone help me pls.
  21. Hi I got a different and typical (for me) requirement from client. Client have a mobile. He will upload XML file from his mobile to my web address (http://111.111.111.111:8080/directoryname/ In my web address, i have to fetch that request (means take XML file) and insert those details into database by using php. Can anyone tell me how can i do this?
×
×
  • 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.