
ellchr3
Members-
Posts
22 -
Joined
-
Last visited
Everything posted by ellchr3
-
You were correct on that. I removed the single quotes around {$_POST['facility_provider_number']} because I was getting "...Cannot convert to a int(4) (column facility_provider_number)..." though. Adding the single quotes back and populating it with an integer worked. Thanks!
-
David, I worked through a few other smaller errors I was able to figure out but now am getting the one below. It still seems something is off in my sql statement. I added the code as it appears after the changes that have been made so far. Warning: odbc_exec() [function.odbc-exec]: SQL error: [sybase][ODBC Driver][sybase IQ]Syntax error near ',' on line 50, SQL state 37000 in SQLExecDirect in C:\provider_database\provider_insert_odbc.php on line 125 $conn = odbc_connect($connect_string,'',''); if (!$conn) {exit("Connection Failed: " . $conn);} // sybase_select_db("crr1", $con); $sql = "INSERT INTO provider_dim_bk ( dea_number , facility_application_name , facility_provider_number , npi_number , pager_number , provider_classification_code , provider_department , provider_division , provider_first_name , provider_last_name , provider_middle_name , provider_name_suffix , provider_speciality , provider_subspeciality , provider_full_name , provider_status , practice_group_name , provider_id , active_date_id , inactive_date_id , admitting_privileges_indicator , source_system_type , provider_number , hdw_status , hdw_creation_time , hdw_modified_time , hdw_deleted_time , provider_age , appointment_date , date_of_birth , fellowship , gender , is_employed , license , medical_school , or_specialty_group , practice_address , practice_city , practice_state , practice_zip , residency , title , todays_date ) VALUES ( '{$_POST['dea_number']}' ,'{$_POST['facility_application_name']}' ,{$_POST['facility_provider_number']} ,'{$_POST['npi_number']}' ,'{$_POST['pager_number']}' ,'{$_POST['provider_classification_code']}' ,'{$_POST['provider_department']}' ,'{$_POST['provider_division']}' ,'{$_POST['provider_first_name']}' ,'{$_POST['provider_last_name']}' ,'{$_POST['provider_middle_name']}' ,'{$_POST['provider_name_suffix']}' ,'{$_POST['provider_specialty']}' ,'{$_POST['provider_subspeciality']}' ,'{$_POST['provider_full_name']}' ,'{$_POST['provider_status']}' ,'{$_POST['practice_group_name']}' ,'{$_POST['provider_id']}' ,NULL ,NULL ,'{$_POST['admitting_privileges_indicator']}' ,'Web Interface' ,'{$_POST['provider_number']}' ,'active' ,GETDATE() ,NULL ,NULL ,'{$_POST['provider_age']}' ,'{$_POST['appointment_date']}' ,'{$_POST['date_of_birth']}' ,'{$_POST['fellowship']}' ,'{$_POST['gender']}' ,'{$_POST['is_employed']}' ,'{$_POST['license']}' ,'{$_POST['medical_school']}' ,'{$_POST['or_specialty_group']}' ,'{$_POST['practice_address']}' ,'{$_POST['practice_city']}' ,'{$_POST['practice_state']}' ,'{$_POST['practice_zip']}' ,'{$_POST['residency']}' ,'{$_POST['title']}' ,'{$_POST['todays_date']}' ) " ; //$rs= odbc_exec($conn,$sql); //if (!$rs) //{exit("Error in SQL");} echo '<center>'; echo "1 record added"; echo '<br><br>'; echo '<a href="localhost\index.html">Click here to enter another record</a>'; echo '</center>'; odbc_close($conn);
-
Awesome. That did take care of that error. Now I'm getting : Warning: odbc_exec() [function.odbc-exec]: SQL error: [sybase][ODBC Driver][sybase IQ]Syntax error near '`' on line 1, SQL state 37000 in SQLExecDirect in C:\provider_database\provider_insert_odbc.php on line 124 Error in SQL Would that have to do with the literals I'm attempting to insert? I tried to follow some examples I've found but they vary so much. I'm still VERY new to PHP so I apologize. Line 124 is my $rs=odbc_exec($conn,$sql); statement. Also, I use notepad++ to write my code. Is there something that would work better as far as parsing out /debugging code? Thanks, Chris
-
Sorry for the first set of code showing as text only. I've added it here too for easier readability. <?php //================================================================ // Configure connection parameters $db_host = "X"; $db_server_name = "X"; $db_name = "X"; $db_file = 'X'; $db_conn_name = "X"; $db_user = "X"; $db_pass = "X"; //================================================================ $connect_string = "Driver={SQL Anywhere 11};". "CommLinks=tcpip(Host=$db_host);". "ServerName=$db_server_name;". "DatabaseName=$db_name;". "DatabaseFile=$db_file;". "ConnectionName=$db_conn_name;". "uid=$db_user;pwd=$db_pass"; // Connect to DB $conn = odbc_connect($connect_string,'',''); if (!$conn) {exit("Connection Failed: " . $conn);} // sybase_select_db("crr1", $con); $sql = "INSERT INTO `providers_bk` ( `dea_number` , `facility_application_name` , `facility_provider_number` , `npi_number` , `pager_number` , `provider_classification_code` , `provider_department` , `provider_division` , `provider_first_name` , `provider_last_name` , `provider_middle_name` , `provider_name_suffix` , `provider_specialty` , `provider_subspeciality` , `provider_full_name` , `provider_status` , `practice_group_name` , `provider_id` , `active_date_id` , `inactive_date_id` , `admitting_privileges_indicator` , `source_system_type` , `provider_number` , `hdw_status` , `hdw_creation_time` , `hdw_modified_time` , `hdw_deleted_time` , `provider_age` , `appointment_date` , `date_of_birth` , `fellowship` , `gender` , `is_employed` , `license` , `medical_school` , `or_specialty_group` , `practice_address` , `practice_city` , `practice_state` , `practice_zip` , `residency` , `title` , `todays_date` ) VALUES ( '($_POST['dea_number'])' ,'($_POST['facility_application_name'])' ,'($_POST['facility_provider_number'])' ,'($_POST['npi_number'])' ,'($_POST['pager_number'])' ,'($_POST['provider_classification_code'])' ,'($_POST['provider_department'])' ,'($_POST['provider_division'])' ,'($_POST['provider_first_name'])' ,'($_POST['provider_last_name'])' ,'($_POST['provider_middle_name'])' ,'($_POST['provider_name_suffix'])' ,'($_POST['provider_specialty'])' ,'($_POST['provider_subspeciality'])' ,'($_POST['provider_full_name'])' ,'($_POST['provider_status'])' ,'($_POST['practice_group_name'])' ,'($_POST['provider_id'])' ,NULL ,NULL ,'($_POST['admitting_privileges_indicator'])' ,'Web Interface' ,'($_POST['provider_number'])' ,'active' ,GETDATE() ,NULL ,NULL ,'($_POST['provider_age'])' ,'($_POST['appointment_date'])' ,'($_POST['date_of_birth'])' ,'($_POST['fellowship'])' ,'($_POST['gender'])' ,'($_POST['is_employed'])' ,'($_POST['license'])' ,'($_POST['medical_school'])' ,'($_POST['or_specialty_group'])' ,'($_POST['practice_address'])' ,'($_POST['practice_city'])' ,'($_POST['practice_state'])' ,'($_POST['practice_zip'])' ,'($_POST['residency'])' ,'($_POST['title'])' ,'($_POST['todays_date'])' ) " ; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} echo '<center>'; echo "1 record added"; echo '<br><br>'; echo '<a href="localhost\index.html">Click here to enter another record</a>'; echo '</center>'; odbc_close($conn); ?>
-
Hey all. I'm having trouble getting an insert to work using an odbc driver. I have to use the odbc connection because I'm connecting to Sybase IQ. Below is the error and code. The second set of code is the page where the record is actually entered. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\provider_database\provider_insert_odbc.php on line 78 <?php //================================================================ // Configure connection parameters $db_host = "X"; $db_server_name = "X"; $db_name = "X"; $db_file = 'X'; $db_conn_name = "X; $db_user = "X"; $db_pass = "X"; //================================================================ $connect_string = "Driver={SQL Anywhere 11};". "CommLinks=tcpip(Host=$db_host);". "ServerName=$db_server_name;". "DatabaseName=$db_name;". "DatabaseFile=$db_file;". "ConnectionName=$db_conn_name;". "uid=$db_user;pwd=$db_pass"; // Connect to DB $conn = odbc_connect($connect_string,'',''); if (!$conn) {exit("Connection Failed: " . $conn);} // sybase_select_db("crr1", $con); $sql = "INSERT INTO `providers_bk` ( `dea_number` , `facility_application_name` , `facility_provider_number` , `npi_number` , `pager_number` , `provider_classification_code` , `provider_department` , `provider_division` , `provider_first_name` , `provider_last_name` , `provider_middle_name` , `provider_name_suffix` , `provider_specialty` , `provider_subspeciality` , `provider_full_name` , `provider_status` , `practice_group_name` , `provider_id` , `active_date_id` , `inactive_date_id` , `admitting_privileges_indicator` , `source_system_type` , `provider_number` , `hdw_status` , `hdw_creation_time` , `hdw_modified_time` , `hdw_deleted_time` , `provider_age` , `appointment_date` , `date_of_birth` , `fellowship` , `gender` , `is_employed` , `license` , `medical_school` , `or_specialty_group` , `practice_address` , `practice_city` , `practice_state` , `practice_zip` , `residency` , `title` , `todays_date` ) VALUES ( '($_POST['dea_number'])' ,'($_POST['facility_application_name'])' ,'($_POST['facility_provider_number'])' ,'($_POST['npi_number'])' ,'($_POST['pager_number'])' ,'($_POST['provider_classification_code'])' ,'($_POST['provider_department'])' ,'($_POST['provider_division'])' ,'($_POST['provider_first_name'])' ,'($_POST['provider_last_name'])' ,'($_POST['provider_middle_name'])' ,'($_POST['provider_name_suffix'])' ,'($_POST['provider_specialty'])' ,'($_POST['provider_subspeciality'])' ,'($_POST['provider_full_name'])' ,'($_POST['provider_status'])' ,'($_POST['practice_group_name'])' ,'($_POST['provider_id'])' ,NULL ,NULL ,'($_POST['admitting_privileges_indicator'])' ,'Web Interface' ,'($_POST['provider_number'])' ,'active' ,GETDATE() ,NULL ,NULL ,'($_POST['provider_age'])' ,'($_POST['appointment_date'])' ,'($_POST['date_of_birth'])' ,'($_POST['fellowship'])' ,'($_POST['gender'])' ,'($_POST['is_employed'])' ,'($_POST['license'])' ,'($_POST['medical_school'])' ,'($_POST['or_specialty_group'])' ,'($_POST['practice_address'])' ,'($_POST['practice_city'])' ,'($_POST['practice_state'])' ,'($_POST['practice_zip'])' ,'($_POST['residency'])' ,'($_POST['title'])' ,'($_POST['todays_date'])' ) " ; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} echo '<center>'; echo "1 record added"; echo '<br><br>'; echo '<a href="localhost\index.html">Click here to enter another record</a>'; echo '</center>'; odbc_close($conn); ?> <?php require_once('calendar/classes/tc_calendar.php'); ?> <html> <head> <link href="calendar/calendar.css" rel="stylesheet" type="text/css" /> <script language="javascript" src="calendar/calendar.js"></script> </head> <body bgcolor="white"> <center><table bgcolor="#CCCCCC" width="30%" border="0" cellpadding="2" cellspacing="0"> <form action="provider_insert_odbc.php" method="post"> <img src ="NewLogo.png"> <center> <font size = "12">Provider Database </font> </center> <tr> <td align="right">Warehouse ID: </td><td><input type="text" size="35" tabindex="1" name="provider_id" /></td> </tr> <tr> <td align="right">First Name: </td><td><input type="text" size="35" tabindex="1" name="provider_first_name" /></td> </tr> <tr> <td align="right">Middle Name: </td><td><input type="text" size="25" tabindex="2" name="provider_middle_name" /></td> </tr> <tr> <td align="right">Last Name: </td><td><input type="text" size="35" tabindex="3" name="provider_last_name" /></td> </tr> <tr> <td align="right">Suffix: </td><td><input type="text" size="35" tabindex="3" name="provider_name_suffix" /></td> </tr> <tr> <td align="right">Full Name: </td><td><input type="text" size="50" tabindex="4" name="provider_full_name" /></td> </tr> <tr> <td align="right">Title: </td><td><input type="text" size="5" tabindex="5" name="title" /></td> </tr> <tr> <td align="right">Practice Address: </td><td><input type="text" size="50" tabindex="6" name="practice_address" /></td> </tr> <tr> <td align="right">Practice City: </td><td><input type="text" tabindex="7" name="practice_city" /><br></td> </tr> <tr> <td align="right">Practice State: </td><td><input type="text" tabindex="8" name="practice_state" /><br></td> </tr> <tr> <td align="right">Practice Zip: </td><td><input type="text" tabindex="9" name="practice_zip" /><br></td> </tr> <tr> <td align="right">DEA Number: </td><td><input type="text" size="35" tabindex="10" name="dea_number" /></td> </tr> <tr> <td align="right">NPI Number: </td><td><input type="text" size="35" tabindex="11" name="npi_number" /></td> </tr> <tr> <td align="right">License Number: </td><td><input type="text" size="35" tabindex="12" name="license" /></td> </tr> <tr> <td align="right">Facility Name: </td><td><input type="text" size="35" tabindex="13" name="facility_application_name" /></td> </tr> <tr> <td align="right">Facility Number: </td><td><input type="text" size="35" tabindex="14" name="facility_provider_number" /></td> </tr> <tr> <td align="right">Pager Number: </td><td><input type="text" size="35" tabindex="15" name="pager_number" /></td> </tr> <tr> <td align="right">Classification Code: </td><td><input type="text" size="35" tabindex="16" name="provider_classification_code" /></td> </tr> <tr> <td align="right">Department: </td><td><input type="text" size="35" tabindex="17" name="provider_department" /></td> </tr> <tr> <td align="right">Division: </td><td><input type="text" size="35" tabindex="18" name="provider_division" /></td> </tr> <tr> <td align="right">Specialty: </td><td><input type="text" size="35" tabindex="19" name="provider_specialty" /></td> </tr> <tr> <td align="right">SubSpecialty: </td><td><input type="text" size="35" tabindex="20" name="provider_subspeciality" /></td> </tr> <tr> <td align="right">Status: </td><td><select name="provider_status" tabindex="21"><option value='Aligned'>Aligned</option> <option value='Unaffiliated'>Unaffiliated</option> <option value='UMG'>UMG</option> </select /> </td> <tr> <td align="right">Group Name: </td><td><input type="text" size="35" tabindex="22" name="practice_group_name" /></td> </tr> <tr> <td align="right">Admitting Privileges Indicator: </td><td><input type="text" size="35" tabindex="23" name="admitting_privileges_indicator" /></td> </tr> <tr> <td align="right">Provider Number: </td><td><input type="text" size="35" tabindex="24" name="provider_number" /></td> </tr> <tr> <td align="right">Provider Age: </td><td><input type="text" size="35" tabindex="25" name="provider_age" /></td> </tr> <tr> <td align="right">Appointment Date: </td><td><input type="text" size="35" tabindex="26" name="appointment_date" /></td> </tr> <tr> <td align="right">Date of Birth: </td><td><input type="text" size="35" tabindex="27" name="date_of_birth" /></td> </tr> <tr> <td align="right">Fellowship: </td><td><input type="text" size="35" tabindex="28" name="fellowship" /></td> </tr> <tr> <td align="right">Gender: </td><td><select name="gender" tabindex="29"><option value='Male'>Male</option> <option value='Female'>Female</option> <option value='Other'>Other</option> </select /> </td> </tr> <tr> <td align="right">Is Employed: </td><td><input type="text" size="35" tabindex="30" name="is_employed" /></td> </tr> <tr> <td align="right">Medical School: </td><td><input type="text" size="35" tabindex="31" name="medical_school" /></td> </tr> <tr> <td align="right">OR Specialty Group: </td><td><input type="text" size="35" tabindex="32" name="or_specialty_group" /></td> </tr> <tr> <td align="right">Residency: </td><td><input type="text" size="35" tabindex="33" name="residency" /></td> </tr> <tr> <td align="right">Todays Date: </td><td><input type="text" size="35" tabindex="34" name="todays_date" /></td> </tr> <tr><td align="right">Todays Date: </td><td> <?php $myCalendar = new tc_calendar("date5", true, false); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); //$myCalendar->setDate(date('d'), date('m'), date('Y')); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(2000, 2015); $myCalendar->dateAllow('2008-05-13', '2015-03-01'); $myCalendar->setDateFormat('j F Y'); //$myCalendar->setHeight(350); //$myCalendar->autoSubmit(true, "form1"); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year'); $myCalendar->setSpecificDate(array("2011-04-10", "2011-04-14"), 0, 'month'); $myCalendar->setSpecificDate(array("2011-06-01"), 0, ''); $myCalendar->writeScript(); ?> </td></tr> <tr> <td><td><input type="submit" /></td></td> </tr> </table> <a href="http://192.168.1.20/index.html">Click here to go back </a> </center> </form> </body> </html>
-
Now that I can get my results to display in a text box for editing, what's the best way to do so? The code below is what I was attempting but I can see already it won't work. When the results are displayed it will run the update query too. Plus, I'm not sure how to tell the code which records were changed if multiples were changed. Can someone lead me in the right direction on how to do this? Point me to a tutorial or offer a bit of assistance on how to start? Thanks! echo "<tr><td>$firstname</td>"; echo "<td><input type=\"text\" name=\"firstnameupdate\" value=\"" . $firstname . "\" ></td>"; echo "<td>$middleinitial</td>"; echo "<td>$lastname</td>"; echo "<td>$fullname</td>"; echo "<td>$provider_id</td>"; echo "<td><input type=\"text\" name=\"textfield\" value=\"" . $providerid . "\" ></td>"; //echo "<td>$providerid</td></tr>"; } echo "</table>"; $firstnameupdate='firstnameupdate'; $sql1="UPDATE crr.provider_dim_bk set provider_first_name = $firstnameupdate where provider_id = $provider_id"; $rs1=odbc_exec($conn,$sql1);
-
I've created a simple login script and can't get one part to work. When I enter a username with an invalid password I get the error in the screen shot. I'm wondering if it has to do with the fact that $numrows is returning a -100? Everything else seems to work fine. Line 60 the error refers to is the line "if ($username==$dbusername&&$password=dbpassword)" $sql = "SELECT username, password FROM user_access WHERE username = '$username' AND password = '$password'"; $rs=odbc_exec($conn,$sql); $numrows = odbc_num_rows($rs); if ($numrows !=0) { while ($row = odbc_fetch_array($rs)) { $dbusername = $row['username']; $dbpassword = $row['password']; } echo $numrows; //echo $dbusername; //echo '<br>'; //echo $dbpassword; //check to see if they match if ($username==$dbusername&&$password==$dbpassword) { echo "You're in! Click here to enter the <a href='member.php'>Provider Database</a>"; $_SESSION['username']=$username; } else echo "Incorrect password!"; } else die("Invalid username. User does not exist!"); } else die("Please enter a Username and Password!"); ?>
-
I'm looking to have my query results displayed with an option to "Edit". Once the user clicks "Edit" it will take them to a page with text boxes for each field and allow them to edit(update) the data. Is it better to create a session, query the database for each page, use the GET or POST option, or a combination of any? Or are my thoughts just ridiculous and there's a better way to do what I'm wanting to do? Thanks
-
Display results in a text box to be edited for update query
ellchr3 replied to ellchr3's topic in PHP Coding Help
Jessica, Thanks for your reply. I'm assuming this is to be done to the "value=..." portion of the statement? I've tried lots of different combinations using the slash for escaping the string and even tried the addslashes function that I found in searching and couldn't get it to work. I'm still fairly new to PHP so I do apologize for my ignorance at this point -
Hello, I'm trying to display the results of my query in a text box so that they can be edited, if need be, and updated in the database. I'm getting the error below, with the code below. I've tried a couple of different ways to format the "value" of the text box as you can see by the second one that's commented out and still a no go. Thanks for any help in advance guys. The error below is referring to the code just below here. echo "<td><input type="text" name="firstname" value="$firstname"></td>"; Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\ $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} echo "<table><tr>"; echo "<th>First Name</th>"; echo "<th>Middle Initial</th>"; echo "<th>Last Name</th>"; echo "<th>Full Name</th>"; echo "<th>Provider ID</th></tr>"; while (odbc_fetch_row($rs)) { $firstname=odbc_result($rs,"provider_first_name"); $middleinitial=odbc_result($rs,"provider_middle_name"); $lastname=odbc_result($rs,"provider_last_name"); $fullname=odbc_result($rs,"provider_full_name"); $provider_id=odbc_result($rs,"provider_id"); echo "<tr><td>$firstname</td>"; echo "<td><input type="text" name="firstname" value="$firstname"></td>"; echo "<td>$middleinitial</td>"; echo "<td>$lastname</td>"; echo "<td>$fullname</td>"; echo "<td>$provider_id</td>"; // echo "<td><input type="text" name="textfield" value='".$providerid."'"></td>"; echo "<td>$providerid</td></tr>"; } odbc_close($conn);
-
Variable in where clause using odbc_connect for Sybase
ellchr3 replied to ellchr3's topic in PHP Coding Help
I was making it way harder than what it was. Thanks! -
Hello, I'm trying to display the results of my query in a text box so that they can be edited, if need be, and updated in the database. I'm getting the error below, with the code below. I've tried a couple of different ways to format the "value" of the text box as you can see by the second one that's commented out and still a no go. Thanks for any help in advance guys. The error below is referring to the code just below here. echo "<td><input type="text" name="firstname" value="$firstname"></td>"; Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\ $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} echo "<table><tr>"; echo "<th>First Name</th>"; echo "<th>Middle Initial</th>"; echo "<th>Last Name</th>"; echo "<th>Full Name</th>"; echo "<th>Provider ID</th></tr>"; while (odbc_fetch_row($rs)) { $firstname=odbc_result($rs,"provider_first_name"); $middleinitial=odbc_result($rs,"provider_middle_name"); $lastname=odbc_result($rs,"provider_last_name"); $fullname=odbc_result($rs,"provider_full_name"); $provider_id=odbc_result($rs,"provider_id"); echo "<tr><td>$firstname</td>"; echo "<td><input type="text" name="firstname" value="$firstname"></td>"; echo "<td>$middleinitial</td>"; echo "<td>$lastname</td>"; echo "<td>$fullname</td>"; echo "<td>$provider_id</td>"; // echo "<td><input type="text" name="textfield" value='".$providerid."'"></td>"; echo "<td>$providerid</td></tr>"; } odbc_close($conn);
-
I'm trying to find out how to use a variable in a where clause that's entered from a previous page. I have my input page set up to accept text (may be my problem since I'm looking for an integer, but may have other issues too). I'm using $_POST to pass the value to the php file. Code is below: HTML INPUT: <html> <body> <form method="post" action="display.php"> <label>provider id: <input type="text" name="providerid" /> </label> </form> </body> </html> Query information from display.php: $providerid=$_POST['providerid']; // echo "Logged In as ".$providerid; //$query = odbc_exec("SELECT provider_full_name, provider_id FROM crr.provider_dim"); $sql="SELECT provider_first_name, provider_middle_name, provider_last_name, provider_full_name, provider_id FROM crr.provider_dim where provider_id = ($providerid['providerid']['provider'])";
-
I found a way that works using odbc_connect. I couldn't get anything to work with the sybase_connect no matter what I tried. I don't think it included enough information about the server/database that way. <?php //================================================================ // Configure connection parameters $db_host = "server.mynetwork"; $db_server_name = "Dev_Server"; $db_name = "Dev_Data"; $db_file = 'c:\dbstorage\dev.db'; $db_conn_name = "php_script"; $db_user = "dbuser"; $db_pass = "dbpass"; //================================================================ $connect_string = "Driver={Sql Anywhere 11};". "CommLinks=tcpip(Host=$db_host);". "ServerName=$db_server_name;". "DatabaseName=$db_name;". "DatabaseFile=$db_file;". "ConnectionName=$db_conn_name;". "uid=$db_user;pwd=$db_pass";
-
Okay, I found where I was missing a curly bracket too. Updated code and error below. It's not liking my connection parameters apparently. Below is the syntax for a sybase_connect. Can you tell me if servername is the "Server Name" for Sybase, or the PC/server the database is on? sybase_connect ([ string $servername [, string $username [, string $password [, string $charset [, string $appname [, bool $new = false ]]]]]] ) Fatal error: Call to undefined function sybase_connect() in C.... on line 2 <?php $link = sybase_connect("10.x.x.x:x", "x", "x"); if ( ! $link ) { echo "Connection failed \n " ; } else { echo "Connected successfully \n " ; } sybase_close($link); ?> Thanks for your help.
-
Trq, I tried that too and when I do that I get this: Parse error: syntax error, unexpected '}', expecting ',' or ';' in C:
-
I get the following error with the code below: Parse error: syntax error, unexpected T_IF in C:\prov Any help is appreciated. Thanks! <?php $link = sybase_connect("10.x.x.x:x", "x", "x") if ( ! $link ) { echo "Connection failed \n " } else { echo "Connected successfully \n " ; sybase_close($link); ?>
-
I'm trying to connect to Sybase IQ and just display two columns of a table. When I try to view the html page it shows some of the php code (attached). The code is below. I'm still a noob, especially to the sybase iq part . I have also verified that the dll exists in the php/ext directory and that it is uncommented in the php.ini . I have stopped and started Apache as well after I uncommented the dll from php.ini. <html> <body> <?php $con = sybase_connect("X","X","X"); if (!$con) { die('Could not connect: ' . sybase_set_message_handler()); } sybase_select_db("X", $con); $query = sybase_query("SELECT provider_full_name, provider_id FROM crr.provider_dim"); echo '<center>'; echo '<table border="1" cellspacing="0" cellpadding="10">'; echo "\n<tr><td bgcolor='#CCCCCC'>Full Name</td><td>Provider_ID</td></tr>\n"; while($row = sybase_fetch_array($query)) { echo "\n<tr><td bgcolor='#CCCCCC'>".$row['provider_full_name']."</td><td>".$row['provider_id']."</td></tr>\n"; echo "<br />"; } sybase_close($con); ?> </body> </html>
-
What's the best way to format results from a MySQL table? I've found very vague examples of PHP code utilizing html tables. Below is my current PHP. Thanks! <?php $con = mysql_connect("localhost","xxxxx","xxxxx") or die('Could not connect: ' . mysql_error()); mysql_select_db("addresses", $con); $result = mysql_query("SELECT * FROM addresses"); while($row = mysql_fetch_array($result)) { echo $row['first_name'] . " " . $row['last_name'] . " " . $row['extra_info'] . " " . $row['address'] . " " . $row['city'] . " " . $row['state'] . " " . $row['zip']; echo "<br />"; } mysql_close($con); ?>
-
That was it. Thank you for catching my idiot typo mistake! I don't know how I missed it for that long.
-
Even with changing the single and double quotes to the way you specified, Adib, it still doesn't create the hyperlink. Could it be something with the web server setup? I installed Xampp so I thought it configured everything properly. I also made the modifications that Winstons suggested and still get the same results. It doesn't create the hyperlink, only text. Thanks for your help so far guys. Any other suggestions?
-
Hello. I'm having trouble with using hyperlinks in PHP. I've found several things online about using the print or echo command but for some reason it only gives the link as text and not an actual link. I'm very new to PHP so please be gentle <?php $con = mysql_connect("localhost","xxxxx","xxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("addresses", $con); $sql="INSERT INTO addresses (first_name, last_name, extra_info, address, city, state, zip) VALUES ('$_POST[first_name]','$_POST[last_name]','$_POST[extra_info]','$_POST[address]','$_POST[city]','$_POST[state]','$_POST[zip]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; echo "<a ref="http://localhost/index.html">Click here to enter another record</a>"; mysql_close($con) ?>