The wildcard character did not work. Again, probably an issue with the placement of quotes. However, I did have one other question: how do I get the SQL statement to search correctly if the name has an apostrophe in the record (ex. Jane O' Hare), and then get it to display right? I know there's a way to do it with escape characters, but I'm blanking on how to implement it. Otherwise the search is executing fine.
p.s. If you have...
User Profile
Collapse
-
Right, I know the % wildcard in SQL. How would I insert that into my previous code so that it would interpret properly inside the ASP delimiters?...Leave a comment:
-
It worked beautifully! One other quick question- what is the ASP version of a wildcard character, where the user could enter something close to the right name and get the person they're looking for?...Leave a comment:
-
Inserting a Request.Form variable into a SQL statement
I'm trying to access a Request.Form variable and plug it into an SQL statement, so that the statement will select just the particular data I need.
Here's the offending snippet of code:
I assumed that the problem was simply not having quotation marks in the right places, but I've tried many...Code:sql = "SELECT DISTINCT name, extension FROM Employees WHERE name = " & Request.Form("name") -
Thanks again! I suspected that might be the answer, but I didn't know how MySQL handled parentheses. Still a couple more queries to work on... you've been a lot of help so far.Leave a comment:
-
Ok, I'm back! My problem is that a need a version of an either/or statement for a particular query. Here's the current query:
...Code:select workshoptitle from title, titlelink, tracktype, HPC, presenter where tracktype.tracktypeid = hpc.tracktypeid and presenter.presenterid = titlelink.presenterid and hpc.workshoptitleid = titlelink.workshoptitleid and title.workshoptitleid = titlelink.workshoptitleid and hpc.workshoptitleid
Leave a comment:
-
Thanks for the help on that one! I have a couple other queries that I may need help with, too. I'll post those later today. Thanks again.Leave a comment:
-
I wish it were that simple...
here's the result of that query:
...Code:mysql> select workshoptrack, workshoptype, workshopstart, workshopend -> from HPC, title, presenter, tracktype, titlelink -> where tracktype.tracktypeid = hpc.tracktypeid and presenter.presenter = ' Jim Redmon' and title.workshoptitle = 'High Performance Computing and IBMs Lates t Offering, Deep Computing on Demand'Leave a comment:
-
I'm a relative newbie myself, but the most apparent flaw here is that you're trying to initalize a loop with the string elements you declared up above. To initialize a for loop, you need to 1) count the # of elements in the array (in PHP, you use the count() method, in java, the .length method), and 2) initialize a counter that keeps track of the number of loop iterations).
For example:
[PHP]$numElements = count($answer);...Leave a comment:
-
Please help me identify the flaws
I'm a complete newbie when it comes to SQL, and my tables have a serious flaw that I've been unable to correct (unless the fault lies in my queries alone).
Here's the code for my tables:
...Code:drop table HPC; drop table Presenter; drop table TitleLink; drop table TrackType; drop table Title; create table Title (WorkShopTitleID integer, WorkShopTitle
-
SUCCESS!!! My textbook was finally good for something besides a paperweight... the solution is:
[PHP] while(list($ind ex) = each($myFile))
{
for($i = 0; $i < count($myFile[$index]); $i++);
{
$a .= $myFile[$index][$i];
}
}
...Leave a comment:
-
I'm trying to concatenate with the following code:
[PHP] $a = "";
$numElements = count($myFile);
for($i = 0; $i < $numElements; i++)
{
$a .= $myFile[0][$i];
}[/PHP]
for some reason, it's only giving me the first element of the array (i.e. the first employee's info). Any ideas?
P.S. Var_export is no good, because...Leave a comment:
-
Your questions have been extremely helpful! I actually realized, after showing you the output on my last post, that this IS an associative array. I had been seeing one thing in my mind instead of using my eyes to process what was actually happening. Now, my last dilemna is how to get all the lines to write back to the file, as the fwrite command deletes everything in the file to write the new info in... so I can't use a for loop with fwrite command...Leave a comment:
-
The results are exactly what I expected. Before the attempt at writing to the file, I get the elements of the array as:
Array ( [0] => Array ( [0] => Personnel Billy Bob Thornton 888.333.4444 5086 [1] => Personnel Bozo Clown 888.333.4444 928 [2] => Personnel Donkey Kong 888.222.5555 8989 ) )
But, the result after trying the fwrite, is simply the word "Array" being written to the file. What do...Leave a comment:
-
That's the full code, other than the original PHP script that creates the file "employees.dat" . That should make it clearer.Leave a comment:
-
[PHP]?php
/*
loadData: returns an array of lines in a file
Parameters: the name of the file to be loaded, a string
the default is "employees. dat"
Returns: the array of lines in that file
*/
//write loadData here
function loadData($defau ltFileName = "employees.dat" )
{
if(!$defaultFil eName = file("employees .dat"))...Leave a comment:
-
Code:
$file = fopen("employee s.dat", "w");
fwrite($file, var_export($myF ile));
fclose($file);
resulted in a blank "employees. dat" file and displayed the original array as associated with : array[0]=>.Leave a comment:
-
Here's the entire code:
?php
/*
loadData: returns an array of lines in a file
Parameters: the name of the file to be loaded, a string
the default is "employees. dat"
Returns: the array of lines in that file
*/
//write loadData here
function loadData($defau ltFileName = "employees.dat" )
{
if(!$defaultFil eName =...Leave a comment:
-
I checked that one... my issue is that I need this to write to a file instead of displaying on the screen. How would I go about doing that using this method?Leave a comment:
-
Well, it's an array created by the file() method... perhaps it's an associative array?Leave a comment:
No activity results to display
Show More
Leave a comment: