Jump to content

argoSquirrel

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Posts posted by argoSquirrel

  1. Hey Cherny,

    I'm getting some weird behaviour on one of my updates.  I'm binding a variable using OLEDB_TEXT and sending it to a large varchar (2000 or so) and it is having weird issues at 256 chars.  I remember reading somewhere about problems with varchars out to 256 characters and I think I was having this problem before you hinted moving to OLEDB_TEXT.  Well, I just noticed that didn't really solve the problem.  The text length saved is the same as the text I attempted to insert, but it starts to repeat from the beginning and goes on until it is as long as the entered text.

    For example:

    [quote]"Abra Moore (born June 8, 1969 in San Diego, California) is a folk-styled alternative rock singer-songwriter. She is an icon of the Austin, Texas music scene. Her 1997 album Strangest Places spun off the hit "Four Leaf Clover", which saw airplay in Midwest U.S. radio markets and VH1 and MTV2 rotation. Moore's parents named Abra after the heroine of John Steinbeck's East of Eden. She was raised in Puna, Hawaii in a bohemian household that had very strong jazz influences, including jam sessions by guest musicians. When she was 19 she founded Poi Dog Pondering with a group of friends, moving to Los Angeles in 1988 and to Austin in 1992. Moore left the band shortly afterward to pursue a solo career. Her first album was Sing (1995), followed by Strangest Places (1997), which had a companion CD "Live from the Strangest Places", featuring acoustic versions of several tracks from the album.

    Abra continued to work on her next studio album "No Fear", while contributing songs to several soundtracks. Amidst rumors of creative differences and contractual conflicts, she changed management and recording companies and the album was eventually shelved, although her record label, J Records, did release promo copies. Most of the songs later appeared in slightly altered versions on her latest album, "Everything Changed" (2004) released on Koch Records."[/quote]

    When inserted using OLEDB_TEXT produces:

    [quote]Abra Moore (born June 8, 1969 in San Diego, California) is a folk-styled alternative rock singer-songwriter. She is an icon of the Austin, Texas music scene. Her 1997 album Strangest Places spun off the hit "Four Leaf Clover", which saw airplay in Midwest U.S. radio markets and VH1 and MTV2 rotation. Moore's parents named Abra after the heroine of John Steinbeck's East of Eden. She was raised in Puna, Hawaii in a bohemian household that had very strong jazz influences, including jam sessions by guest musicians. When she was 19 she founded Poi Dog Pondering with a group of friends, moving to Los Angeles in 1988 and to Austin in 1992. Moore left the band shortly afterward to pursue a solo career. Her first album was Sing (1995), followed by Strangest Places (1997), which had a companion CD "Live from the Strangest Places", featuring acoustic versions of several tracks from the album.

    Abra continued to work on her next studio album "No Fear", while contributing songs to several soundtracks. Amidst rumAbra Moore (born June 8, 1969 in San Diego, California) is a folk-styled alternative rock singer-songwriter. She is an icon of the Austin, Texas music scene. Her 1997 album Strangest Places spun off the hit "Four Leaf Clover", which saw airplay in Midwest U.S. radio markets and VH1 and MTV2 rotation. Moore's parents named Abra after the[/quote]

    Really weird...
  2. Hey, Cherny.  I took a while off on my project and I'm back working on it now.

    I hit a strange error on one of my assoc fetches.  I really can't figure out what is going on with the code as it is basically a copy of code that works elsewhere.  Here is the error in hopes you can tell me what it means from an OLE point of view so I can fix my code.

    Warning: oledb_fetch_assoc() [function.oledb-fetch-assoc]: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done in C:\wamp\www\artist.php on line 168

    Thanks mate!

    Edit: Code blocks made it hard to read.
  3. If you must store your email in SQL Server, just go ahead and have SQL server mail it for you.  Pass in the variables into a function or SP and mail it using the DBmail SP.  For pre-2005 I think it was called SQLMail.

    I think the call is "sp_send_dbmail" and you can find the parameters online.  Just google it.

    The benefit would be that you could actually have this set up as a trigger on your Users table so it would fire off an email on insert and you would never have to worry about it again.
  4. [quote author=tet3828 link=topic=112534.msg456780#msg456780 date=1161695109]
    I must not have posed this question properly last post....22 reads to 1 response ::). Allow me to simplify...

    I have a database. Each Item in the database will have  the following values:
    CATAGORY
    SUB-CATAGORY
    STORE ITEM NUMBER
    NAME
    DESCRIPTION
    PRICW
    PRICE SMALL PICTURE
    PICTURE

    what script should I start with if I need all items in a selected catagory to be displayed in a table including an itme Name, Thumbnail, and price?

    Thanks again! ;D
    [/quote]

    Ok, you just want items filtered by category?

    If so your SQL would be:
    [code]
    SELECT name, picture, price
    FROM Items
    WHERE category = @var
    [/code]

    Is that what you're asking?
  5. Just FYI, this is not a technique you would want to use on a fairly active site.

    Because you are breaking the query up into 2 separate queries, you may potentially get off sync if an insert occurs between the 2 queries.  Or, for a large site, 100 inserts may occur during that time.  This is 1 reason why Stored Procedures and Transactions are a big deal.

    In your case it may not be a big deal, but I thought I should raise the issue (for the future perhaps ;) )

    Really, what it sounds like you should be doing is not counting on the last row to be your latest news, but having a submit_date field on your News table.  Then you could simply do:

    [code]
    SELECT TOP 1 title, body, etc...
    FROM News
    ORDER BY submit_date DESC
    [/code]
  6. You are only setting $DeptID 1 time outside your outer loop so it will always be set to Dept 1.  Then you are returning the whole set of employees and checking it in php so it will only display those few.

    First, set your $DeptID in the loop so you keep getting a new one every iteration.

    Then try changing your query to:

    $sub_sql="SELECT First_Name, Last_Name FROM qry_Full_Employee_Details WHERE department = '" . $DeptID . "'";

    That will return a much smaller result set and make it run much faster as it only returns the info you need for the people in that department.  You can stop checking for departments then in your inner loop. 

    That should clean up the logic and make it run a lot faster with larger data sets.

    Cheers,
    Argo
  7. If you are really uncomfortable with php and mssql, ignore what I am going to say and use the previous example. 

    If you can, look into what is called a full-text index to do your search.  It is much more powerful and more importantly, a lot faster.  It can be a little more difficult to implement, however. There are plenty of resources online.
  8. Or you could bind the variable using the mssql stored procedure functions.

    [code]
    require_once 'Database.php';
    $db = Database::connect('Database_Name');
    $variable = 26;

    $query = mssql_init("spSomeStoredProcedure", $db);
    mssql_bind($query, "@some_id", $variable, MSSQL_NUM, FALSE, FALSE, 7);

    $result = mssql_execute($query);[/code]
  9. [quote author=stockton link=topic=104766.msg443642#msg443642 date=1159533497]
    You are being a little confusing as apt is Linux specific and to the best of my knowledge MSSQL wont work on Linux.
    My setup is Ubuntu as the test client and the server has Windows XP, Apache and PHP and I suspect that you may want to do something similar.
    Do remember that PHP runs on the server not the client and to the best of my knowledge MSSQL has to be on the server.
    [/quote]
    Yes, MSSQL has to be on the server.  A windows server.  However, the web server can be on another server of any type, including linux.  3-tier.

    As for doing it with MSSQL, sorry, never done it.
  10. [quote author=chernyshevsky link=topic=106192.msg432506#msg432506 date=1158034253]
    [quote author=argoSquirrel link=topic=106192.msg432495#msg432495 date=1158031596]
    @oops
    Why don't you just use a Stored Procedure?  You seem to be about 1 step away already and you would then get to benefit from the inherent benefits of SPs (speed, reusability, lower bandwidth).  It also allows you to better extract the business case into the DB layer, which is (arguably) a better solution.

    @Cherny
    [s]I seem to be hitting a limit of 255 chars on a varchar return.  I'm just doing a fetch_assoc.  This a problem?[/s]

    Sorry, it's actually on the update.
    [/quote]

    Hmmm, you mean when you call a stored-proc? By default, oledb_bind will chop off a string at 255 if maxlen is omitted. Here's the full definition of the function:

    oledb_bind ( resource stmt, string param_name, mixed &var, int type [, int is_output [, int is_null [, int maxlen]]] )

    Binding to OLEDB_TEXT does not have this limitation.
    [/quote]

    I do have maxlen specified.  I have it set to 1000.  Does oledb_varchar support MAX instead of a integer value? 

    Text seems to work fine.
  11. @oops
    Why don't you just use a Stored Procedure?  You seem to be about 1 step away already and you would then get to benefit from the inherent benefits of SPs (speed, reusability, lower bandwidth).  It also allows you to better extract the business case into the DB layer, which is (arguably) a better solution.

    @Cherny
    [s]I seem to be hitting a limit of 255 chars on a varchar return.  I'm just doing a fetch_assoc.  This a problem?[/s]

    Sorry, it's actually on the update.
  12. [quote author=argoSquirrel link=topic=106192.msg428846#msg428846 date=1157498118]
    Same error across the board.
    [/quote]

    Actually, it's not across the board.  It only breaks on SP calls with no input parameters.  If there is a bind it does not break.

    Also, I'm a total idiot and overwrote version .5 and don't have a copy available.  You still have it lying around?
  13. [quote author=chernyshevsky link=topic=106192.msg426985#msg426985 date=1157257869]
    Okay, I have fixed both issues. You were right about the oledb_execute() running the stored-proc multiple times. I had inadvertently set the number of parameter sets to the number of parameters. Stupid mistake. I have also implemented output parameter and return variable, features I had forgot about. oledb_num_rows() now works the way it should. I had busted it earlier while getting the extension to work with Active Directory. It's still a function you shouldn't depend on: it doesn't work when the record set is large (> 1000). That's simply a nature of SQL Server--because rows could disappear while the record set is open, it simply can't know how number there are.

    Here's the link again:

    http://sourceforge.net/project/showfiles.php?group_id=171247&package_id=198554

    Thanks a lot for your help. OLE-DB is so broad that it's very hard for me to check for issues alone.
    [/quote]

    Yeah, NP.  I am glad to help whenever.

    I'm generally using num_rows to trap errors on null sets (I know, I should return errors in my SPs, but I'm lazy) so I don't think 1000 + will ever be an issue.
  14. [quote author=wildteen88 link=topic=106022.msg427769#msg427769 date=1157381952]
    XAMPP has three php.ini's. The correct ini you should edit is loacted in C:\[your xampp install path]\xampp\apache\bin\

    When you made the changes save php.ini and restart the Apache server.

    Also have a read of this FAQ from Xampps site:
    [quote=http://www.apachefriends.org/en/faq-xampp-windows.html#phpini]I do not get any connection to my MS SQL server!
    If the mssql extension was loaded in the php.ini, sometimes it comes to access problems when only TCP/IP is used. You can fix that problem with a newer "ntwdblib.dll" from Microsoft. Please replace the older file in the \xampp\apache\bin directory with your newer file from Microsoft. Apache restart. Thank you Horst for this topic note![/quote]
    [/quote]

    Fantastic to know, and I do feel rather stupid.  I just loaded up Wamp and have been going fine.  Thanks though.
  15. As for each project having a number of images or files, what you are trying to model is a one-to-many relationship: 1 project can have many images or files.  You would want a images table with many images and each image would have a foreign key back to the primary key (project_id) in the projects table.  If you want an image or file to be able to be used on more than 1 project, you would need a different structure.

    Also, do you mean actually store the image or file in access?  I have nearly no experience with access, but I'm not sure it can store binary data.  If it can, you may be luck.

    As for the xml:

    Why exactly are you trying to build a database in xml? Just looking at that xml structure it appears it is ripe for a relational database to do storage and display. You may have technical reasons, but i had to ask.  I'm just not sure what you are doing.
×
×
  • 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.