Jump to content

kdawg2k12

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kdawg2k12's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. does anyone know who to resolve this issue of importing a CSV file from excel into sql? I get this error when I do. LOAD DATA LOCAL INFILE '/tmp/phpq2aAbU' INTO TABLE `Events` FIELDS TERMINATED BY ',' ENCLOSED BY '\\"' ESCAPED BY '\\\\' LINES TERMINATED BY '\r\n'
  2. it doesn't but i contacted my hosting company and they don't support microsoft drivers their servers are unix based. I will transfer access db to mysql thanks
  3. Hi everyone can anyone tell me why my code displays fine in the test environment but doesn't display in the live? Does the paths have to be different? //$conn = odbc_connect('myEvents','',''); $dbFile = realpath('Databases/myEvents.mdb'); $dbDir = dirname($dbFile); $conn = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};DBQ=$dbFile;" , '', ''); $sql= "SELECT month,day,year,time,event,location FROM Events ORDER By ID"; $rs="$conn,$sql";
  4. Okay guys I have finished my db and I want to upload it to a live server but don't know exactly what to change in the code to get the ODBC_connect to open the path at the new server location please help. my database is located in a subfolder called Databases i.e. "www.mydomain.com/Databases/myEvents.mdb" what do i change in the connection string below to get it to open the file on the live server? Thanks in advance. $conn = odbc_connect('myEvents','','');
  5. okay guys I found the problem I assigned the eventDay variable twice. thanks for your input
  6. Here's the Code guys Thanks <!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> <body> <?PHP $thisMonth = date('m'); $thisDay = date('j'); $eventMonth = array(); $eventDay = array(); $eventYear= array(); $eventTime = array(); $eventName = array(); $eventLocation = array(); $textMonth= array(); $dbMonth=""; $dbDay=""; $i=1; $row=1; $conn = odbc_connect('myEvents','',''); $sql= "SELECT month,day, year, time, event,location FROM Events ORDER By ID"; $rs="$conn,$sql"; if (!$conn) { exit("Connection Failed: " . $conn); } $rs=odbc_exec($conn,$sql); if(!$rs) { exit("Error in SQL"); } $dbMonth=odbc_result($rs,"month"); $dbDay=odbc_result($rs,"day"); while($i<4) { if($dbMonth<$thisMonth) { odbc_fetch_row($rs); $dbMonth=odbc_result($rs,"month"); $dbDay=odbc_result($rs,"day"); } if($dbMonth==$thisMonth) if($dbDay< $thisDay) { odbc_fetch_row($rs); $dbMonth=odbc_result($rs,"month"); $dbDay=odbc_result($rs,"day"); } if($dbMonth==$thisMonth) if($dbDay>= $thisDay) { if($i<4) { if($dbMonth=="01") { $dbMonth="January"; $eventMonth[$i]= "January"; } if($dbMonth=="02") { $dbMonth="February"; $eventMonth[$i]= "February"; } if($dbMonth=="03") { $dbMonth="March"; $eventMonth[$i]= "March"; } if($dbMonth=="04") { $dbMonth="April"; $eventMonth[$i]= "April"; } if($dbMonth=="05") { $dbMonth="May"; $eventMonth[$i]= "May"; } if($dbMonth=="06") { $dbMonth="June"; $eventMonth[$i]= "June"; } if($dbMonth=="07") { $dbMonth="July"; $eventMonth[$i]= "July"; } if($dbMonth=="08") { $dbMonth="August"; $eventMonth[$i]= "August"; } if($dbMonth=="09") { $dbMonth="September"; $eventMonth[$i]= "September"; } if($dbMonth=="10") { $dbMonth="October"; $eventMonth[$i]= "October"; } if($dbMonth=="11") { $dbMonth="November"; $eventMonth[$i]= "November"; } if($dbMonth=="12") { $dbMonth="December"; $eventMonth[$i]= "December"; } $eventMonth[$i]; $eventDay[$i]=odbc_result($rs,"day")."\n"; $eventYear[$i]=odbc_result($rs,"year")."\n"; $eventTime[$i]=odbc_result($rs,"time")."\n"; $eventDay[$i]=odbc_result($rs,"event")."\n"; $eventLocation[$i]=odbc_result($rs,"location")."\n"; $i++; odbc_fetch_row($rs); $dbMonth=odbc_result($rs,"month"); $dbDay=odbc_result($rs,"day"); } } if($dbMonth>$thisMonth) if($dbDay< $thisDay) { if($i<4) { if($dbMonth=="01") { $dbMonth="January"; $eventMonth[$i]= "January"; } if($dbMonth=="02") { $dbMonth="February"; $eventMonth[$i]= "February"; } if($dbMonth=="03") { $dbMonth="March"; $eventMonth[$i]= "March"; } if($dbMonth=="04") { $dbMonth="April"; $eventMonth[$i]= "April"; } if($dbMonth=="05") { $dbMonth="May"; $eventMonth[$i]= "May"; } if($dbMonth=="06") { $dbMonth="June"; $eventMonth[$i]= "June"; } if($dbMonth=="07") { $dbMonth="July"; $eventMonth[$i]= "July"; } if($dbMonth=="08") { $dbMonth="August"; $eventMonth[$i]= "August"; } if($dbMonth=="09") { $dbMonth="September"; $eventMonth[$i]= "September"; } if($dbMonth=="10") { $dbMonth="October"; $eventMonth[$i]= "October"; } if($dbMonth=="11") { $dbMonth="November"; $eventMonth[$i]= "November"; } if($dbMonth=="12") { $dbMonth="December"; $eventMonth[$i]= "December"; } $eventMonth[$i]; $eventDay[$i]=odbc_result($rs,"day"); $eventYear[$i]=odbc_result($rs,"year"); $eventTime[$i]=odbc_result($rs,"time"); $eventDay[$i]=odbc_result($rs,"event"); $eventLocation[$i]=odbc_result($rs,"location")."\n"; $i++; odbc_fetch_row($rs); $dbMonth=odbc_result($rs,"month"); $dbDay=odbc_result($rs,"day"); } } if($dbMonth>=$thisMonth) if($dbDay>= $thisDay) { if($i<4) { if($dbMonth=="01") { $dbMonth="January"; $eventMonth[$i]= "January"; } if($dbMonth=="02") { $dbMonth="February"; $eventMonth[$i]= "February"; } if($dbMonth=="03") { $dbMonth="March"; $eventMonth[$i]= "March"; } if($dbMonth=="04") { $dbMonth="April"; $eventMonth[$i]= "April"; } if($dbMonth=="05") { $dbMonth="May"; $eventMonth[$i]= "May"; } if($dbMonth=="06") { $dbMonth="June"; $eventMonth[$i]= "June"; } if($dbMonth=="07") { $dbMonth="July"; $eventMonth[$i]= "July"; } if($dbMonth=="08") { $dbMonth="August"; $eventMonth[$i]= "August"; } if($dbMonth=="09") { $dbMonth="September"; $eventMonth[$i]= "September"; } if($dbMonth=="10") { $dbMonth="October"; $eventMonth[$i]= "October"; } if($dbMonth=="11") { $dbMonth="November"; $eventMonth[$i]= "November"; } if($dbMonth=="12") { $dbMonth="December"; $eventMonth[$i]= "December"; } $eventMonth[$i]; $eventDay[$i]=odbc_result($rs,"day")."\n"; $eventYear[$i]=odbc_result($rs,"year")."\n"; $eventTime[$i]=odbc_result($rs,"time")."\n"; $eventDay[$i]=odbc_result($rs,"event")."\n"; $eventLocation[$i]=odbc_result($rs,"location")."\n"; $i++; odbc_fetch_row($rs); $dbMonth=odbc_result($rs,"month"); $dbDay=odbc_result($rs,"day"); } } } odbc_close($conn); ?> <div> <?php echo $eventMonth[1]; echo $eventDay[2]; echo $eventYear[1]; echo $eventLocation[1]; ?> </div> </body> </html>
  7. okay this sounds strange I know but but apart from html code in pure php the database values display correctly but when I combine with HTML code i get an offset error when retrieving certain values example results from database file no HTML coding: February10 2012 5pm MY EVENT NEW YORK ERROR when combined with HTML: February MYEVENT 2012 NewYork
  8. CAN ANYONE TELL ME WHAT i AM DOING WRONG. I WANT TO RETRIEVE THE VERY FIRST RECORD IN MY DATABASE WHEN THE CODE EXECUTE IT ONLY SHOWS THE LAST RECORD IN THE DATABASE <?PHP $thisMonth = date('M'); $thisDay = date('j'); $eventMonth = array(); $eventDay = array(); $eventTime = array(); $eventName = array(); $eventLocation = array(); $dbMonth=""; $dbDay=""; $i=0; $conn = odbc_connect('eventsDB','',''); $sql= "SELECT month,day, time, event,location FROM Events"; $rs="$conn,$sql"; if (!$conn) { exit("Connection Failed: " . $conn); } $rs=odbc_exec($conn,$sql); if(!$rs) { exit("Error in SQL"); } echo "DATABASE OPEN"; while($i<3) { $dbMonth= odbc_result($rs,"month"); echo $eventMonth[$i]=odbc_result($rs,"month")."\n"; if($dbMonth<>$thisMonth) { odbc_fetch_row($rs); } echo $eventMonth[$i]=odbc_result($rs,"month")."\n"; echo $eventDay[$i]=odbc_result($rs,"day")."\n"; echo $eventTime[$i]=odbc_result($rs,"time")."\n"; echo $eventDay[$i]=odbc_result($rs,"event")."\n"; echo $eventLocation[$i]=odbc_result($rs,"location")."\n"; $i++; odbc_fetch_row($rs); echo $i; } //ends while loop odbc_close($conn); ?>
  9. Does anyone know what this error means? Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] DRIVER keyword syntax error,
  10. can anyone give me an example of how to establish an ODBC connection with PHP. I have a MS ACCESS database i want to open and read from thanks
  11. no, i thought I could use my live domain server for testing i.e. smptp.mail@mydomain.com do i need to install one for it to work correctly?
  12. okay i resolved the last error and now I am getting this error Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_ I would like to use a secure connection and use port 465 but I do not know all the parameters i need to configure to do this please advise and thanks for the help guys I am a newbe to PHP
  13. Pikachu2000 yes that is the full script I have a html form that retrieves the information. Can someone give me an example of what I need to change in the PHP.INI file to test it locally? and What I should have in the email.php file when i upload it to the live server? I been racking my brain tryna figure this stuff out for over a week now!
  14. @ ANDY H I am not sure what you are referring to when you say should the full stop be here? I am new to PHP thanks for the quick replies
  15. this is my email.php file <?php $senderName =$_POST['userName']; $senderEmail =$_POST['userEmail.']; $senderMessage =$_POST['userMessage.']; //security $senderName=stripslashes($userName); $senderEmail=stripslashes($userEmail); $senderMsg=stripslashes($userMessage); $to = 'myName@mydomain.com'; $from = 'myName@mydomain.com'; $subject = 'Testing CONTACT PAGE'; $message = 'Message From your site: Their Name: $senderName Their Email: $senderEmail Their Message is below: $senderMsg'; // Build $headers Variable $headers = 'From: Company <mysite@mydomain.com.com>' . "\r\n"; $to = '$to'; // Send the email mail($to, $subject, $message, $headers); $my_msg='thanks your message has been sent.'; print $my_msg; ?> The error I'm getting is this: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\PHP_Test\email.php on line 5 all I want to be able to do is verify my form works and that I can receive emails from users of mysite any help would be greatly appreciated. Also what should the send_mail in the PHP.INI file be set to? thansk
×
×
  • 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.